// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2015 Alec Jacobson // // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "unproject.h" #include "model_proj_viewport.h" #include "../unproject.h" #include "gl.h" #include #include IGL_INLINE void igl::opengl2::unproject( const double winX, const double winY, const double winZ, double* objX, double* objY, double* objZ) { Eigen::Vector3d obj; igl::opengl2::unproject(Eigen::Vector3d(winX,winY,winZ),obj); *objX = obj(0); *objY = obj(1); *objZ = obj(2); } template IGL_INLINE void igl::opengl2::unproject( const Eigen::PlainObjectBase & win, Eigen::PlainObjectBase & obj) { const auto ret = igl::opengl2::unproject(win); obj = ret.template cast(); } template IGL_INLINE Derivedwin igl::opengl2::unproject( const Eigen::PlainObjectBase & win) { using namespace Eigen; typedef typename Derivedwin::Scalar Scalar; Matrix4d MV,P; Vector4d VPd; model_proj_viewport(MV,P,VPd); Vector3d wind = win.template cast(); Vector3d objd = igl::unproject(wind,MV,P,VPd); return objd.template cast(); } #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation // generated by autoexplicit.sh template void igl::opengl2::unproject, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase >&); template void igl::opengl2::unproject, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase >&); template Eigen::Matrix igl::opengl2::unproject >(Eigen::PlainObjectBase > const&); template Eigen::Matrix igl::opengl2::unproject >(Eigen::PlainObjectBase > const&); template void igl::opengl2::unproject, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase >&); #endif