12345678910111213141516171819202122232425262728293031323334353637383940 |
- #include "unproject.h"
- #ifndef IGL_NO_OPENGL
- #include "OpenGL_convenience.h"
- IGL_INLINE int igl::unproject(
- const double winX,
- const double winY,
- const double winZ,
- double* objX,
- double* objY,
- double* objZ)
- {
- // Put model, projection, and viewport matrices into double arrays
- double MV[16];
- double P[16];
- int VP[4];
- glGetDoublev(GL_MODELVIEW_MATRIX, MV);
- glGetDoublev(GL_PROJECTION_MATRIX, P);
- glGetIntegerv(GL_VIEWPORT, VP);
- return gluUnProject(winX,winY,winZ,MV,P,VP,objX,objY,objZ);
- }
- template <typename Derivedwin, typename Derivedobj>
- IGL_INLINE int igl::unproject(
- const Eigen::PlainObjectBase<Derivedwin> & win,
- Eigen::PlainObjectBase<Derivedobj> & obj)
- {
- return unproject(win(0),win(1),win(2),
- &obj.data()[0],
- &obj.data()[1],
- &obj.data()[2]);
- }
- #ifndef IGL_HEADER_ONLY
- // Explicit template instanciation
- template int igl::unproject<Eigen::Matrix<double, 3, 1, 0, 3, 1>, Eigen::Matrix<double, 3, 1, 0, 3, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >&);
- #endif
- #endif
|