Added Buildings

Fixed rendering bugs with edges
This commit is contained in:
Bram Verhulst
2024-04-22 00:32:06 +02:00
parent 5477b8a7f2
commit e578a77d84
10 changed files with 66 additions and 19 deletions

View File

@@ -232,15 +232,16 @@ void utils::FillPolygon(const std::vector<Vector2f>& vertices) {
}
void utils::DrawArrow(const Vector2f& start, const Vector2f& end, float lineWidth, float arrowSize) {
// Origin is bottom left
utils::DrawLine(start, end);
Vector2f arrowEnd = end - start;
Vector2f dir = end - start;
const float arrowAngle = atan2f(end.y - start.y, end.x - start.x);
const float arrowAngle1 = arrowAngle + g_Pi + 0.4f;
const float arrowAngle2 = arrowAngle + g_Pi - 0.4f;
utils::SetColor(Colors::RED);
utils::DrawLine(end, end + Vector2f{ dir.y, -dir.x }.Normalized() * arrowSize);
utils::DrawLine(end, end + Vector2f{ -dir.y, dir.x }.Normalized() * arrowSize);
const Vector2f arrow1 { end.x + arrowSize * cosf(arrowAngle1), end.y + arrowSize * sinf(arrowAngle1) };
const Vector2f arrow2 { end.x + arrowSize * cosf(arrowAngle2), end.y + arrowSize * sinf(arrowAngle2) };
utils::DrawLine(end, arrow1);
utils::DrawLine(end, arrow2);
}
void utils::FillPolygon(const Vector2f* pVertices, size_t nrVertices) {