fix Matrix44 infinite product, make glGetv not allocate temporary

This commit is contained in:
Paolo Cignoni 2008-10-30 10:47:08 +00:00
parent 49c72bc54e
commit dfc97ba1f2
2 changed files with 6 additions and 8 deletions

View File

@ -464,9 +464,9 @@ template<typename Other,int OtherCols>
struct ei_matrix44_product_impl<Other, 4,OtherCols> struct ei_matrix44_product_impl<Other, 4,OtherCols>
{ {
typedef typename Other::Scalar Scalar; typedef typename Other::Scalar Scalar;
typedef typename Eigen::ProductReturnType<Matrix44<Scalar>,Other>::Type ResultType; typedef typename Eigen::ProductReturnType<typename Matrix44<Scalar>::Base,Other>::Type ResultType;
static ResultType run(const Matrix44<Scalar>& tr, const Other& other) static ResultType run(const Matrix44<Scalar>& tr, const Other& other)
{ return tr * other; } { return (static_cast<const typename Matrix44<Scalar>::Base&>(tr)) * other; }
}; };
template<typename Other> template<typename Other>

View File

@ -133,14 +133,12 @@ inline void glGetv(const GLenum pname, Eigen::Matrix<double,4,4>& matrix){
glGetDoublev(pname,matrix.data()); glGetDoublev(pname,matrix.data());
} }
inline void glGetv(const GLenum pname, Eigen::Matrix<float,4,4,Eigen::RowMajor>& matrix){ inline void glGetv(const GLenum pname, Eigen::Matrix<float,4,4,Eigen::RowMajor>& matrix){
Eigen::Matrix4f tmp; glGetFloatv(pname,matrix.data());
glGetFloatv(pname,tmp.data()); matrix.transposeInPlace();
matrix = tmp;
} }
inline void glGetv(const GLenum pname, Eigen::Matrix<double,4,4,Eigen::RowMajor>& matrix){ inline void glGetv(const GLenum pname, Eigen::Matrix<double,4,4,Eigen::RowMajor>& matrix){
Eigen::Matrix4d tmp; glGetDoublev(pname,matrix.data());
glGetDoublev(pname,tmp.data()); matrix.transposeInPlace();
matrix = tmp;
} }
template<typename Scalar> template<typename Scalar>
inline void glGetv(const GLenum pname, const Eigen::Transform<Scalar,3>& t) inline void glGetv(const GLenum pname, const Eigen::Transform<Scalar,3>& t)