Math相关头文件移到hgl/math目录
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#ifndef HGL_ALGORITHM_VECTOR_MATH_INCLUDE
|
||||
#ifndef HGL_ALGORITHM_VECTOR_MATH_INCLUDE
|
||||
#define HGL_ALGORITHM_VECTOR_MATH_INCLUDE
|
||||
|
||||
#include<hgl/type/DataType.h>
|
||||
@@ -6,11 +6,11 @@
|
||||
//注:GLM/CML(OpenGLMode)是列矩阵,计算坐标matrix*pos
|
||||
// 而MGL是行矩阵,需要反过来pos*matrix
|
||||
|
||||
#include<hgl/algorithm/MathMGL.h> // Game Math and Geometry Library
|
||||
#include<hgl/math/MathMGL.h> // Game Math and Geometry Library
|
||||
|
||||
namespace hgl
|
||||
{
|
||||
namespace algorithm
|
||||
namespace math
|
||||
{
|
||||
double Lsin(int angle); ///<低精度sin计算,注意传入的参数为角度而非弧度
|
||||
double Lcos(int angle); ///<低精度cos计算,注意传入的参数为角度而非弧度
|
||||
@@ -150,6 +150,6 @@ namespace hgl
|
||||
result.x = center.x + ((source.x - center.x)*ac - (source.y - center.y)*as);
|
||||
result.y = center.y + ((source.x - center.x)*as + (source.y - center.y)*ac);
|
||||
}
|
||||
}//namespace algorithm
|
||||
}//namespace math
|
||||
}//namespace hgl
|
||||
#endif//HGL_ALGORITHM_VECTOR_MATH_INCLUDE
|
@@ -1,4 +1,4 @@
|
||||
#ifndef HGL_ALGORITHM_VECTOR_MATH_MGL_INCLUDE
|
||||
#ifndef HGL_ALGORITHM_VECTOR_MATH_MGL_INCLUDE
|
||||
#define HGL_ALGORITHM_VECTOR_MATH_MGL_INCLUDE
|
||||
|
||||
#ifdef _MSC_VER
|
||||
@@ -119,11 +119,21 @@ namespace hgl
|
||||
return m.Inverted();
|
||||
}
|
||||
|
||||
inline Matrix4f ortho2d(float width,float height,float znear=0,float zfar=1)
|
||||
/**
|
||||
* 生成一个2D正角视图矩阵
|
||||
* @param width 宽
|
||||
* @param height 高
|
||||
* @param top_to_bottom 从上到下(是否最顶部y轴为0,默认否)
|
||||
* @param znear 近平面z值
|
||||
* @param zfar 远平台z值
|
||||
*/
|
||||
inline Matrix4f ortho2d(float width,float height,bool top_to_bottom=false,float znear=0,float zfar=1)
|
||||
{
|
||||
//MathGeoLib生成的2D正交矩阵中心是0,0,所以需要偏移
|
||||
|
||||
return Matrix4f::OpenGLOrthoProjRH(znear,zfar,width,height)*Matrix4f::Scale(1,-1,1)*Matrix4f::Translate(-(width/2.0f),-(height/2.0f),0);
|
||||
return Matrix4f::OpenGLOrthoProjRH(znear,zfar,width,height)
|
||||
*Matrix4f::Scale(1,top_to_bottom?-1:1,1)
|
||||
*Matrix4f::Translate(-(width/2.0f),-(height/2.0f),0);
|
||||
}
|
||||
|
||||
inline Matrix4f translate(const Vector3f &v)
|
@@ -3,7 +3,7 @@
|
||||
|
||||
#include<hgl/type/BaseString.h>
|
||||
#include<hgl/type/Map.h>
|
||||
#include<hgl/algorithm/Math.h>
|
||||
#include<hgl/math/Math.h>
|
||||
// #include<hgl/graph/UBO.h>
|
||||
// #include<hgl/graph/SSBO.h>
|
||||
namespace hgl
|
||||
|
Reference in New Issue
Block a user