[core] Port "collision group" plumbing to gl-native.

[node] Hook up map-wide "crossSourceCollisions" option, defaulting to true.
[test] Pass "crossSourceCollisions" test option through test harness; enable cross-source-collisions tests on native.
This commit is contained in:
Chris Loer
2018-09-06 14:58:37 -07:00
committed by Chris Loer
parent 079ba0209e
commit d735d89835
17 changed files with 149 additions and 50 deletions

View File

@@ -82,21 +82,29 @@ std::vector<std::pair<T, typename GridIndex<T>::BBox>> GridIndex<T>::queryWithBo
}
template <class T>
bool GridIndex<T>::hitTest(const BBox& queryBBox) const {
bool GridIndex<T>::hitTest(const BBox& queryBBox, optional<std::function<bool(const T&)>> predicate) const {
bool hit = false;
query(queryBBox, [&](const T&, const BBox&) -> bool {
hit = true;
return true;
query(queryBBox, [&](const T& t, const BBox&) -> bool {
if (!predicate || (*predicate)(t)) {
hit = true;
return true;
} else {
return false;
}
});
return hit;
}
template <class T>
bool GridIndex<T>::hitTest(const BCircle& queryBCircle) const {
bool GridIndex<T>::hitTest(const BCircle& queryBCircle, optional<std::function<bool(const T&)>> predicate) const {
bool hit = false;
query(queryBCircle, [&](const T&, const BBox&) -> bool {
hit = true;
return true;
query(queryBCircle, [&](const T& t, const BBox&) -> bool {
if (!predicate || (*predicate)(t)) {
hit = true;
return true;
} else {
return false;
}
});
return hit;
}