You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
This commit is contained in:
@@ -33,7 +33,6 @@
|
||||
#include "core/print_string.h"
|
||||
|
||||
BroadPhaseSW::ID BroadPhaseBasic::create(CollisionObjectSW *p_object, int p_subindex, const AABB &p_aabb) {
|
||||
|
||||
ERR_FAIL_COND_V(p_object == NULL, 0);
|
||||
|
||||
current++;
|
||||
@@ -48,27 +47,22 @@ BroadPhaseSW::ID BroadPhaseBasic::create(CollisionObjectSW *p_object, int p_subi
|
||||
}
|
||||
|
||||
void BroadPhaseBasic::move(ID p_id, const AABB &p_aabb) {
|
||||
|
||||
Map<ID, Element>::Element *E = element_map.find(p_id);
|
||||
ERR_FAIL_COND(!E);
|
||||
E->get().aabb = p_aabb;
|
||||
}
|
||||
void BroadPhaseBasic::set_static(ID p_id, bool p_static) {
|
||||
|
||||
Map<ID, Element>::Element *E = element_map.find(p_id);
|
||||
ERR_FAIL_COND(!E);
|
||||
E->get()._static = p_static;
|
||||
}
|
||||
void BroadPhaseBasic::remove(ID p_id) {
|
||||
|
||||
Map<ID, Element>::Element *E = element_map.find(p_id);
|
||||
ERR_FAIL_COND(!E);
|
||||
List<PairKey> to_erase;
|
||||
//unpair must be done immediately on removal to avoid potential invalid pointers
|
||||
for (Map<PairKey, void *>::Element *F = pair_map.front(); F; F = F->next()) {
|
||||
|
||||
if (F->key().a == p_id || F->key().b == p_id) {
|
||||
|
||||
if (unpair_callback) {
|
||||
Element *elem_A = &element_map[F->key().a];
|
||||
Element *elem_B = &element_map[F->key().b];
|
||||
@@ -78,7 +72,6 @@ void BroadPhaseBasic::remove(ID p_id) {
|
||||
}
|
||||
}
|
||||
while (to_erase.size()) {
|
||||
|
||||
pair_map.erase(to_erase.front()->get());
|
||||
to_erase.pop_front();
|
||||
}
|
||||
@@ -86,33 +79,27 @@ void BroadPhaseBasic::remove(ID p_id) {
|
||||
}
|
||||
|
||||
CollisionObjectSW *BroadPhaseBasic::get_object(ID p_id) const {
|
||||
|
||||
const Map<ID, Element>::Element *E = element_map.find(p_id);
|
||||
ERR_FAIL_COND_V(!E, NULL);
|
||||
return E->get().owner;
|
||||
}
|
||||
bool BroadPhaseBasic::is_static(ID p_id) const {
|
||||
|
||||
const Map<ID, Element>::Element *E = element_map.find(p_id);
|
||||
ERR_FAIL_COND_V(!E, false);
|
||||
return E->get()._static;
|
||||
}
|
||||
int BroadPhaseBasic::get_subindex(ID p_id) const {
|
||||
|
||||
const Map<ID, Element>::Element *E = element_map.find(p_id);
|
||||
ERR_FAIL_COND_V(!E, -1);
|
||||
return E->get().subindex;
|
||||
}
|
||||
|
||||
int BroadPhaseBasic::cull_point(const Vector3 &p_point, 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 AABB aabb = E->get().aabb;
|
||||
if (aabb.has_point(p_point)) {
|
||||
|
||||
p_results[rc] = E->get().owner;
|
||||
p_result_indices[rc] = E->get().subindex;
|
||||
rc++;
|
||||
@@ -125,14 +112,11 @@ int BroadPhaseBasic::cull_point(const Vector3 &p_point, CollisionObjectSW **p_re
|
||||
}
|
||||
|
||||
int BroadPhaseBasic::cull_segment(const Vector3 &p_from, const Vector3 &p_to, 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 AABB aabb = E->get().aabb;
|
||||
if (aabb.intersects_segment(p_from, p_to)) {
|
||||
|
||||
p_results[rc] = E->get().owner;
|
||||
p_result_indices[rc] = E->get().subindex;
|
||||
rc++;
|
||||
@@ -144,14 +128,11 @@ int BroadPhaseBasic::cull_segment(const Vector3 &p_from, const Vector3 &p_to, Co
|
||||
return rc;
|
||||
}
|
||||
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 AABB aabb = E->get().aabb;
|
||||
if (aabb.intersects(p_aabb)) {
|
||||
|
||||
p_results[rc] = E->get().owner;
|
||||
p_result_indices[rc] = E->get().subindex;
|
||||
rc++;
|
||||
@@ -164,23 +145,18 @@ int BroadPhaseBasic::cull_aabb(const AABB &p_aabb, CollisionObjectSW **p_results
|
||||
}
|
||||
|
||||
void BroadPhaseBasic::set_pair_callback(PairCallback p_pair_callback, void *p_userdata) {
|
||||
|
||||
pair_userdata = p_userdata;
|
||||
pair_callback = p_pair_callback;
|
||||
}
|
||||
void BroadPhaseBasic::set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata) {
|
||||
|
||||
unpair_userdata = p_userdata;
|
||||
unpair_callback = p_unpair_callback;
|
||||
}
|
||||
|
||||
void BroadPhaseBasic::update() {
|
||||
|
||||
// recompute pairs
|
||||
for (Map<ID, Element>::Element *I = element_map.front(); I; I = I->next()) {
|
||||
|
||||
for (Map<ID, Element>::Element *J = I->next(); J; J = J->next()) {
|
||||
|
||||
Element *elem_A = &I->get();
|
||||
Element *elem_B = &J->get();
|
||||
|
||||
@@ -200,7 +176,6 @@ void BroadPhaseBasic::update() {
|
||||
}
|
||||
|
||||
if (pair_ok && !E) {
|
||||
|
||||
void *data = NULL;
|
||||
if (pair_callback) {
|
||||
data = pair_callback(elem_A->owner, elem_A->subindex, elem_B->owner, elem_B->subindex, unpair_userdata);
|
||||
@@ -214,12 +189,10 @@ void BroadPhaseBasic::update() {
|
||||
}
|
||||
|
||||
BroadPhaseSW *BroadPhaseBasic::_create() {
|
||||
|
||||
return memnew(BroadPhaseBasic);
|
||||
}
|
||||
|
||||
BroadPhaseBasic::BroadPhaseBasic() {
|
||||
|
||||
current = 1;
|
||||
unpair_callback = NULL;
|
||||
unpair_userdata = NULL;
|
||||
|
||||
Reference in New Issue
Block a user