Skip to content

Commit f696571

Browse files
committed
Try to fix Mac build
CURA-12743
1 parent 23c9f9f commit f696571

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

src/project.cpp

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Triangle3F getFaceTriangle(const std::span<Point3F>& mesh_vertices, const Face&
3030

3131
Triangle2F getFaceUv(const std::span<Point2F>& mesh_uv, const Face& face)
3232
{
33-
return Triangle2F(mesh_uv[face.i1], mesh_uv[face.i2], mesh_uv[face.i3]);
33+
return Triangle2F{ mesh_uv[face.i1], mesh_uv[face.i2], mesh_uv[face.i3] };
3434
}
3535

3636
Point2F projectToViewport(const Point3F& point, const Matrix44F& matrix, const bool is_camera_perspective, const int viewport_width, const int viewport_height)
@@ -42,7 +42,7 @@ Point2F projectToViewport(const Point3F& point, const Matrix44F& matrix, const b
4242
projected /= (projected.z() * 2.0f);
4343
}
4444

45-
return Point2F(projected.x() * viewport_width / 2.0f, projected.y() * viewport_height / 2.0f);
45+
return Point2F{ projected.x() * viewport_width / 2.0f, projected.y() * viewport_height / 2.0f };
4646
}
4747

4848
Triangle2F projectToViewport(const Triangle3F& triangle, const Matrix44F& matrix, const bool is_camera_perspective, const int viewport_width, const int viewport_height)
@@ -99,19 +99,7 @@ Point2F getTextureCoordinates(const Point3F& barycentric_coordinates, const Tria
9999
{
100100
const float u = (uv_coordinates.p1.x * barycentric_coordinates.x()) + (uv_coordinates.p2.x * barycentric_coordinates.y()) + (uv_coordinates.p3.x * barycentric_coordinates.z());
101101
const float v = (uv_coordinates.p1.y * barycentric_coordinates.x()) + (uv_coordinates.p2.y * barycentric_coordinates.y()) + (uv_coordinates.p3.y * barycentric_coordinates.z());
102-
return Point2F(u * texture_width, v * texture_height);
103-
}
104-
105-
template<typename RangeOrInitList>
106-
void addClipperPath(const RangeOrInitList& polygon, const ClipperLib::PolyType type, ClipperLib::Clipper& clipper)
107-
{
108-
ClipperLib::Path path;
109-
path.reserve(std::size(polygon));
110-
for (const Point2F& point : polygon)
111-
{
112-
path.emplace_back(std::llround(point.x * CLIPPER_PRECISION), std::llround(point.y * CLIPPER_PRECISION));
113-
}
114-
clipper.AddPath(path, type, true);
102+
return Point2F{ u * texture_width, v * texture_height };
115103
}
116104

117105
template<typename RangeOrInitList>
@@ -121,7 +109,7 @@ ClipperLib::Path toPath(const RangeOrInitList& polygon)
121109
path.reserve(std::size(polygon));
122110
for (const Point2F& point : polygon)
123111
{
124-
path.emplace_back(std::llround(point.x * CLIPPER_PRECISION), std::llround(point.y * CLIPPER_PRECISION));
112+
path.push_back(ClipperLib::IntPoint{ std::llround(point.x * CLIPPER_PRECISION), std::llround(point.y * CLIPPER_PRECISION) });
125113
}
126114
return path;
127115
}
@@ -159,7 +147,7 @@ std::vector<Polygon> toPolygons(const ClipperLib::Paths& paths)
159147
result_polygon.reserve(path.size());
160148
for (const ClipperLib::IntPoint& point : path)
161149
{
162-
result_polygon.emplace_back(point.X / CLIPPER_PRECISION, point.Y / CLIPPER_PRECISION);
150+
result_polygon.push_back(Point2F{ point.X / CLIPPER_PRECISION, point.Y / CLIPPER_PRECISION });
163151
}
164152

165153
result.push_back(std::move(result_polygon));
@@ -208,7 +196,8 @@ std::vector<Polygon> project(
208196
}
209197

210198
const Triangle2F projected_face_triangle = projectToViewport(face_triangle, camera_projection_matrix, is_camera_perspective, viewport_width, viewport_height);
211-
const ClipperLib::Path projected_face_triangle_path = toPath(std::initializer_list{ projected_face_triangle.p1, projected_face_triangle.p2, projected_face_triangle.p3 });
199+
const ClipperLib::Path projected_face_triangle_path
200+
= toPath(std::initializer_list<Point2F>{ projected_face_triangle.p1, projected_face_triangle.p2, projected_face_triangle.p3 });
212201
const std::vector<Polygon> uv_areas = toPolygons(intersect(stroke_polygon_path, projected_face_triangle_path));
213202

214203
if (uv_areas.empty())

src/unwrap.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <range/v3/view/map.hpp>
1313
#include <spdlog/spdlog.h>
1414

15-
#include "Face.h"
1615
#include "Matrix33F.h"
1716
#include "Point2F.h"
1817
#include "Point3F.h"

0 commit comments

Comments
 (0)