Skip to content

Commit

Permalink
Work on layered tile maps.
Browse files Browse the repository at this point in the history
  • Loading branch information
Relintai committed Mar 4, 2024
1 parent 3e533b3 commit 4abb1a2
Show file tree
Hide file tree
Showing 3 changed files with 311 additions and 238 deletions.
13 changes: 13 additions & 0 deletions core/math/geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,19 @@ class Geometry {
return (intersections & 1);
}

static bool is_segment_intersecting_polygon(const Vector2 &p_from, const Vector2 &p_to, const Vector<Vector2> &p_polygon) {
int c = p_polygon.size();
const Vector2 *p = p_polygon.ptr();
for (int i = 0; i < c; i++) {
const Vector2 &v1 = p[i];
const Vector2 &v2 = p[(i + 1) % c];
if (segment_intersects_segment_2d(p_from, p_to, v1, v2, nullptr)) {
return true;
}
}
return false;
}

static PoolVector<PoolVector<Face3>> separate_objects(PoolVector<Face3> p_array);

// Create a "wrap" that encloses the given geometry.
Expand Down
Loading

0 comments on commit 4abb1a2

Please sign in to comment.