From f5d3d3d2e791b31c0f51b26db47df2c9bb4f381d Mon Sep 17 00:00:00 2001 From: Patrik Huber Date: Sun, 26 Mar 2023 18:48:04 +0100 Subject: [PATCH] Removed unnecessary GLM #include's --- include/eos/fitting/closest_edge_fitting.hpp | 5 ----- include/eos/render/normals.hpp | 21 ------------------- include/eos/render/ray_triangle_intersect.hpp | 3 +-- include/eos/render/texture_extraction.hpp | 7 +------ include/eos/render/vertex_visibility.hpp | 8 ------- 5 files changed, 2 insertions(+), 42 deletions(-) diff --git a/include/eos/fitting/closest_edge_fitting.hpp b/include/eos/fitting/closest_edge_fitting.hpp index 9260974cf..2572dc585 100644 --- a/include/eos/fitting/closest_edge_fitting.hpp +++ b/include/eos/fitting/closest_edge_fitting.hpp @@ -32,11 +32,6 @@ #include "nanoflann.hpp" -#include "glm/common.hpp" -#include "glm/vec3.hpp" -#include "glm/vec4.hpp" -#include "glm/mat4x4.hpp" - #include "Eigen/Core" #include diff --git a/include/eos/render/normals.hpp b/include/eos/render/normals.hpp index 4473fee07..1b22aac8b 100644 --- a/include/eos/render/normals.hpp +++ b/include/eos/render/normals.hpp @@ -22,9 +22,6 @@ #ifndef EOS_RENDER_NORMALS_HPP #define EOS_RENDER_NORMALS_HPP -#include "glm/vec3.hpp" -#include "glm/geometric.hpp" - #include "Eigen/Core" #include @@ -68,24 +65,6 @@ inline Eigen::Vector3f compute_face_normal(const Eigen::Vector4f& v0, const Eige return n.head<3>().normalized(); }; -/** - * Computes the normal of a face (triangle), i.e. the per-face normal. Returned normal will be unit length. - * - * Assumes the triangle is given in CCW order, i.e. vertices in counterclockwise order on the screen are - * front-facing. - * - * @param[in] v0 First vertex. - * @param[in] v1 Second vertex. - * @param[in] v2 Third vertex. - * @return The unit-length normal of the given triangle. - */ -inline glm::vec3 compute_face_normal(const glm::vec3& v0, const glm::vec3& v1, const glm::vec3& v2) -{ - glm::vec3 n = glm::cross(v1 - v0, v2 - v0); // v0-to-v1 x v0-to-v2 - n = glm::normalize(n); - return n; -}; - /** * Computes the per-face (per-triangle) normals of all triangles of the given mesh. Returned normals will be unit length. * diff --git a/include/eos/render/ray_triangle_intersect.hpp b/include/eos/render/ray_triangle_intersect.hpp index 294b46e1a..ac6315e17 100644 --- a/include/eos/render/ray_triangle_intersect.hpp +++ b/include/eos/render/ray_triangle_intersect.hpp @@ -24,8 +24,7 @@ #include "eos/cpp17/optional.hpp" -#include "glm/vec3.hpp" -#include "glm/geometric.hpp" +#include "Eigen/Core" #include diff --git a/include/eos/render/texture_extraction.hpp b/include/eos/render/texture_extraction.hpp index 440792143..587cc6580 100644 --- a/include/eos/render/texture_extraction.hpp +++ b/include/eos/render/texture_extraction.hpp @@ -33,11 +33,6 @@ #include "eos/render/ray_triangle_intersect.hpp" #include "eos/render/detail/utils.hpp" // for detail::divide_by_w() -#include "glm/mat4x4.hpp" -#include "glm/vec2.hpp" -#include "glm/vec3.hpp" -#include "glm/vec4.hpp" - #include #include #include @@ -59,7 +54,7 @@ namespace render { * set to true, the angle will be encoded into the alpha channel (0 meaning occluded or facing away 90°, * 127 meaning facing a 45° angle and 255 meaning front-facing, and all values in between). If set to * false, the alpha channel will only contain 0 for occluded vertices and 255 for visible vertices.` - * - We perhaps should add another parameter, `glm::vec4 viewport`. We could need to change + * - We perhaps should add another parameter, `Eigen::Vector4 viewport`. We could need to change * `clip_to_screen_space()` to make use of that. * - Perhaps add an overload that takes a `vector visible vertices`, for the case when we already * computed the visibility? (e.g. from the edge-fitting) diff --git a/include/eos/render/vertex_visibility.hpp b/include/eos/render/vertex_visibility.hpp index 6c74edf05..874174bca 100644 --- a/include/eos/render/vertex_visibility.hpp +++ b/include/eos/render/vertex_visibility.hpp @@ -27,10 +27,6 @@ #include "Eigen/Core" -#include "glm/vec3.hpp" -#include "glm/vec4.hpp" -#include "glm/mat4x4.hpp" - #include #include #include @@ -47,10 +43,6 @@ namespace render { * Depending on \p ray_direction_type, the rays are either casted from each vertex along the positive z axis, * or towards the origin (0, 0, 0). * - * Note/Todo: We have a bit of an unnecessary conversion between GLM and Eigen going on. Ideally, ...: - * - probe_vertex should rather be an Eigen::Vector3f - * - mesh_vertices should rather be std::vector. - * * @param[in] probe_vertex A single vertex to compute the visibility for. * @param[in] mesh_vertices A set of vertices that form a mesh. * @param[in] mesh_triangle_vertex_indices Triangle indices corresponding to the given mesh.