|
@@ -17,6 +17,30 @@ namespace igl
|
|
|
{
|
|
|
// Forward define
|
|
|
class EmbreeIntersector;
|
|
|
+ // Unproject a screen location (using the given model, proj and viewport) to find
|
|
|
+ // the first hit on a mesh.
|
|
|
+ //
|
|
|
+ // Inputs:
|
|
|
+ // pos screen space coordinates
|
|
|
+ // F #F by 3 face matrix
|
|
|
+ // model model matrix
|
|
|
+ // proj projection matrix
|
|
|
+ // viewport vieweport vector
|
|
|
+ // ei EmbreeIntersector containing (V,F)
|
|
|
+ // Outputs:
|
|
|
+ // fid id of the first face hit
|
|
|
+ // bc barycentric coordinates of hit
|
|
|
+ // Returns true if there is a hit
|
|
|
+ IGL_INLINE bool unproject_onto_mesh(
|
|
|
+ const Eigen::Vector2f& pos,
|
|
|
+ const Eigen::MatrixXi& F,
|
|
|
+ const Eigen::Matrix4f& model,
|
|
|
+ const Eigen::Matrix4f& proj,
|
|
|
+ const Eigen::Vector4f& viewport,
|
|
|
+ const igl::EmbreeIntersector & ei,
|
|
|
+ int& fid,
|
|
|
+ Eigen::Vector3f& bc);
|
|
|
+
|
|
|
// Unproject a screen location (using the given model, proj and viewport) to find
|
|
|
// the first face on the mesh and the closest vertex
|
|
|
//
|
|
@@ -31,9 +55,6 @@ namespace igl
|
|
|
// fid id of the first face hit
|
|
|
// vid vertex id of the closest vertex hit
|
|
|
// Returns true if there is a hit
|
|
|
- //
|
|
|
- // Known bugs: This should return the barycentric coordinates in F(fid,:)
|
|
|
- // rather than vid.
|
|
|
IGL_INLINE bool unproject_onto_mesh(
|
|
|
const Eigen::Vector2f& pos,
|
|
|
const Eigen::MatrixXi& F,
|
|
@@ -43,6 +64,7 @@ namespace igl
|
|
|
const igl::EmbreeIntersector & ei,
|
|
|
int& fid,
|
|
|
int& vid);
|
|
|
+
|
|
|
}
|
|
|
#ifndef IGL_STATIC_LIBRARY
|
|
|
# include "unproject_onto_mesh.cpp"
|