Implement painting properties over TileSets

This commit is contained in:
Gilles Roudière 2021-06-09 20:01:08 +02:00
parent eb318d3e04
commit 30a615dd94
20 changed files with 4993 additions and 2103 deletions

View file

@ -362,6 +362,19 @@ public:
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(p_from, p_to, v1, v2, nullptr)) {
return true;
}
}
return false;
}
static real_t vec2_cross(const Point2 &O, const Point2 &A, const Point2 &B) {
return (real_t)(A.x - O.x) * (B.y - O.y) - (real_t)(A.y - O.y) * (B.x - O.x);
}