You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Refactor layer_mask to collision_layer
This commit is contained in:
@@ -32,12 +32,12 @@
|
||||
#include "global_config.h"
|
||||
#include "physics_server_sw.h"
|
||||
|
||||
_FORCE_INLINE_ static bool _match_object_type_query(CollisionObjectSW *p_object, uint32_t p_layer_mask, uint32_t p_type_mask) {
|
||||
_FORCE_INLINE_ static bool _match_object_type_query(CollisionObjectSW *p_object, uint32_t p_collision_layer, uint32_t p_type_mask) {
|
||||
|
||||
if (p_object->get_type() == CollisionObjectSW::TYPE_AREA)
|
||||
return p_type_mask & PhysicsDirectSpaceState::TYPE_MASK_AREA;
|
||||
|
||||
if ((p_object->get_layer_mask() & p_layer_mask) == 0)
|
||||
if ((p_object->get_collision_layer() & p_collision_layer) == 0)
|
||||
return false;
|
||||
|
||||
BodySW *body = static_cast<BodySW *>(p_object);
|
||||
@@ -45,7 +45,7 @@ _FORCE_INLINE_ static bool _match_object_type_query(CollisionObjectSW *p_object,
|
||||
return (1 << body->get_mode()) & p_type_mask;
|
||||
}
|
||||
|
||||
bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set<RID> &p_exclude, uint32_t p_layer_mask, uint32_t p_object_type_mask, bool p_pick_ray) {
|
||||
bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask, bool p_pick_ray) {
|
||||
|
||||
ERR_FAIL_COND_V(space->locked, false);
|
||||
|
||||
@@ -67,7 +67,7 @@ bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3 &p_from, const Vecto
|
||||
|
||||
for (int i = 0; i < amount; i++) {
|
||||
|
||||
if (!_match_object_type_query(space->intersection_query_results[i], p_layer_mask, p_object_type_mask))
|
||||
if (!_match_object_type_query(space->intersection_query_results[i], p_collision_layer, p_object_type_mask))
|
||||
continue;
|
||||
|
||||
if (p_pick_ray && !(static_cast<CollisionObjectSW *>(space->intersection_query_results[i])->is_ray_pickable()))
|
||||
@@ -123,7 +123,7 @@ bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3 &p_from, const Vecto
|
||||
return true;
|
||||
}
|
||||
|
||||
int PhysicsDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Transform &p_xform, real_t p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_layer_mask, uint32_t p_object_type_mask) {
|
||||
int PhysicsDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Transform &p_xform, real_t p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask) {
|
||||
|
||||
if (p_result_max <= 0)
|
||||
return 0;
|
||||
@@ -144,7 +144,7 @@ int PhysicsDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Transfo
|
||||
if (cc >= p_result_max)
|
||||
break;
|
||||
|
||||
if (!_match_object_type_query(space->intersection_query_results[i], p_layer_mask, p_object_type_mask))
|
||||
if (!_match_object_type_query(space->intersection_query_results[i], p_collision_layer, p_object_type_mask))
|
||||
continue;
|
||||
|
||||
//area can't be picked by ray (default)
|
||||
@@ -174,7 +174,7 @@ int PhysicsDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Transfo
|
||||
return cc;
|
||||
}
|
||||
|
||||
bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, real_t p_margin, real_t &p_closest_safe, real_t &p_closest_unsafe, const Set<RID> &p_exclude, uint32_t p_layer_mask, uint32_t p_object_type_mask, ShapeRestInfo *r_info) {
|
||||
bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, real_t p_margin, real_t &p_closest_safe, real_t &p_closest_unsafe, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask, ShapeRestInfo *r_info) {
|
||||
|
||||
ShapeSW *shape = static_cast<PhysicsServerSW *>(PhysicsServer::get_singleton())->shape_owner.get(p_shape);
|
||||
ERR_FAIL_COND_V(!shape, false);
|
||||
@@ -204,7 +204,7 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform
|
||||
|
||||
for (int i = 0; i < amount; i++) {
|
||||
|
||||
if (!_match_object_type_query(space->intersection_query_results[i], p_layer_mask, p_object_type_mask))
|
||||
if (!_match_object_type_query(space->intersection_query_results[i], p_collision_layer, p_object_type_mask))
|
||||
continue;
|
||||
|
||||
if (p_exclude.has(space->intersection_query_results[i]->get_self()))
|
||||
@@ -295,7 +295,7 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PhysicsDirectSpaceStateSW::collide_shape(RID p_shape, const Transform &p_shape_xform, real_t p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude, uint32_t p_layer_mask, uint32_t p_object_type_mask) {
|
||||
bool PhysicsDirectSpaceStateSW::collide_shape(RID p_shape, const Transform &p_shape_xform, real_t p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask) {
|
||||
|
||||
if (p_result_max <= 0)
|
||||
return 0;
|
||||
@@ -325,7 +325,7 @@ bool PhysicsDirectSpaceStateSW::collide_shape(RID p_shape, const Transform &p_sh
|
||||
|
||||
for (int i = 0; i < amount; i++) {
|
||||
|
||||
if (!_match_object_type_query(space->intersection_query_results[i], p_layer_mask, p_object_type_mask))
|
||||
if (!_match_object_type_query(space->intersection_query_results[i], p_collision_layer, p_object_type_mask))
|
||||
continue;
|
||||
|
||||
const CollisionObjectSW *col_obj = space->intersection_query_results[i];
|
||||
@@ -374,7 +374,7 @@ static void _rest_cbk_result(const Vector3 &p_point_A, const Vector3 &p_point_B,
|
||||
rd->best_object = rd->object;
|
||||
rd->best_shape = rd->shape;
|
||||
}
|
||||
bool PhysicsDirectSpaceStateSW::rest_info(RID p_shape, const Transform &p_shape_xform, real_t p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude, uint32_t p_layer_mask, uint32_t p_object_type_mask) {
|
||||
bool PhysicsDirectSpaceStateSW::rest_info(RID p_shape, const Transform &p_shape_xform, real_t p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask) {
|
||||
|
||||
ShapeSW *shape = static_cast<PhysicsServerSW *>(PhysicsServer::get_singleton())->shape_owner.get(p_shape);
|
||||
ERR_FAIL_COND_V(!shape, 0);
|
||||
@@ -391,7 +391,7 @@ bool PhysicsDirectSpaceStateSW::rest_info(RID p_shape, const Transform &p_shape_
|
||||
|
||||
for (int i = 0; i < amount; i++) {
|
||||
|
||||
if (!_match_object_type_query(space->intersection_query_results[i], p_layer_mask, p_object_type_mask))
|
||||
if (!_match_object_type_query(space->intersection_query_results[i], p_collision_layer, p_object_type_mask))
|
||||
continue;
|
||||
|
||||
const CollisionObjectSW *col_obj = space->intersection_query_results[i];
|
||||
|
||||
Reference in New Issue
Block a user