#ifndef HGL_ALGORITHM_MATH_VECTOR_MATRIX_INCLUDE #define HGL_ALGORITHM_MATH_VECTOR_MATRIX_INCLUDE #include #include //注:GLM/CML(OpenGLMode)是列矩阵,计算坐标matrix*pos // 而MGL是行矩阵,需要反过来pos*matrix #include #include #include #include #include namespace hgl { using Quatf=glm::quat; const Quatf IdentityQuatf(1,0,0,0); //w,x,y,z #define DEFINE_MATRIX(num) using Matrix##num##f=glm::mat##num; \ const Matrix##num##f Identity##num##f=Matrix##num##f(1.0f); \ inline bool IsIdentityMatrix(const Matrix##num##f &m){return(hgl_cmp(m,Identity##num##f)==0);} \ inline bool IsNearlyEqual(const Matrix##num##f &m1,const Matrix##num##f &m2,const float err=HGL_FLOAT_ERROR) \ { \ float *f1=(float *)&m1;\ float *f2=(float *)&m2;\ \ for(int i=0;i