Commit 4c6eebec authored by Patrik Huber's avatar Patrik Huber Committed by GitHub

Merge pull request #109 from NextDesign1/explicit-casts-to-vec3

Explicit casts and initializations to glm::vec3

The implicit conversions don't seem to work on OS X clang-3.9.1. A bit odd, since it works on travis on Linux with clang-3.9, 4.0 and 5.0.
Anyway, maybe in the future we can change it back if a Mac clang update fixes this.
parents d475d222 56b8497a
...@@ -131,7 +131,7 @@ inline std::vector<int> occluding_boundary_vertices(const core::Mesh& mesh, cons ...@@ -131,7 +131,7 @@ inline std::vector<int> occluding_boundary_vertices(const core::Mesh& mesh, cons
// Compute the face normals of the rotated mesh: // Compute the face normals of the rotated mesh:
std::vector<glm::vec3> facenormals; std::vector<glm::vec3> facenormals;
for (auto&& f : mesh.tvi) { // for each face (triangle): for (auto&& f : mesh.tvi) { // for each face (triangle):
auto n = render::compute_face_normal(rotated_vertices[f[0]], rotated_vertices[f[1]], rotated_vertices[f[2]]); auto n = render::compute_face_normal(glm::vec3(rotated_vertices[f[0]]), glm::vec3(rotated_vertices[f[1]]), glm::vec3(rotated_vertices[f[2]]));
facenormals.push_back(n); facenormals.push_back(n);
} }
...@@ -180,7 +180,7 @@ inline std::vector<int> occluding_boundary_vertices(const core::Mesh& mesh, cons ...@@ -180,7 +180,7 @@ inline std::vector<int> occluding_boundary_vertices(const core::Mesh& mesh, cons
auto& v1 = rotated_vertices[tri[1]]; auto& v1 = rotated_vertices[tri[1]];
auto& v2 = rotated_vertices[tri[2]]; auto& v2 = rotated_vertices[tri[2]];
glm::vec3 ray_origin = rotated_vertices[vertex_idx]; glm::vec3 ray_origin(rotated_vertices[vertex_idx]);
glm::vec3 ray_direction(0.0f, 0.0f, 1.0f); // we shoot the ray from the vertex towards the camera glm::vec3 ray_direction(0.0f, 0.0f, 1.0f); // we shoot the ray from the vertex towards the camera
auto intersect = ray_triangle_intersect(ray_origin, ray_direction, glm::vec3(v0), glm::vec3(v1), glm::vec3(v2), false); auto intersect = ray_triangle_intersect(ray_origin, ray_direction, glm::vec3(v0), glm::vec3(v1), glm::vec3(v2), false);
// first is bool intersect, second is the distance t // first is bool intersect, second is the distance t
......
...@@ -232,7 +232,7 @@ inline cv::Mat extract_texture(core::Mesh mesh, cv::Mat affine_camera_matrix, cv ...@@ -232,7 +232,7 @@ inline cv::Mat extract_texture(core::Mesh mesh, cv::Mat affine_camera_matrix, cv
for (int y = min(dst_tri[0].y, min(dst_tri[1].y, dst_tri[2].y)); y < max(dst_tri[0].y, max(dst_tri[1].y, dst_tri[2].y)); ++y) { for (int y = min(dst_tri[0].y, min(dst_tri[1].y, dst_tri[2].y)); y < max(dst_tri[0].y, max(dst_tri[1].y, dst_tri[2].y)); ++y) {
if (detail::is_point_in_triangle(cv::Point2f(x, y), dst_tri[0], dst_tri[1], dst_tri[2])) { if (detail::is_point_in_triangle(cv::Point2f(x, y), dst_tri[0], dst_tri[1], dst_tri[2])) {
// As the coordinates of the transformed pixel in the image will most likely not lie on a texel, we have to choose how to // As the coordinates of the transformed pixel in the image will most likely not lie on a texel, we have to choose how to
// calculate the pixel colors depending on the next texels // calculate the pixel colors depending on the next texels
// there are three different texture interpolation methods: area, bilinear and nearest neighbour // there are three different texture interpolation methods: area, bilinear and nearest neighbour
...@@ -408,7 +408,7 @@ cv::Mat extract_texture(core::Mesh mesh, glm::mat4x4 view_model_matrix, glm::mat ...@@ -408,7 +408,7 @@ cv::Mat extract_texture(core::Mesh mesh, glm::mat4x4 view_model_matrix, glm::mat
auto& v1 = rotated_vertices[tri[1]]; auto& v1 = rotated_vertices[tri[1]];
auto& v2 = rotated_vertices[tri[2]]; auto& v2 = rotated_vertices[tri[2]];
vec3 ray_origin = vertex; vec3 ray_origin(vertex);
vec3 ray_direction(0.0f, 0.0f, 1.0f); // we shoot the ray from the vertex towards the camera vec3 ray_direction(0.0f, 0.0f, 1.0f); // we shoot the ray from the vertex towards the camera
auto intersect = fitting::ray_triangle_intersect(ray_origin, ray_direction, vec3(v0), vec3(v1), auto intersect = fitting::ray_triangle_intersect(ray_origin, ray_direction, vec3(v0), vec3(v1),
vec3(v2), false); vec3(v2), false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment