add 2d matrix functions, they are translate/scale/rotate

This commit is contained in:
hyzboy 2020-12-09 16:28:21 +08:00
parent b3bbccfabc
commit 162a6ce2f2

View File

@ -84,6 +84,11 @@ namespace hgl
return Matrix4f::Translate(x,y,z);
}
inline Matrix4f translate(float x,float y)
{
return Matrix4f::Translate(x,y,1.0f);
}
inline Matrix4f scale(const Vector3f &v)
{
return Matrix4f::Scale(v,Vector3f::zero);
@ -94,6 +99,11 @@ namespace hgl
return Matrix4f::Scale(Vector3f(x,y,z),Vector3f::zero);
}
inline Matrix4f scale(float x,float y)
{
return Matrix4f::Scale(Vector3f(x,y,1.0f),Vector3f::zero);
}
inline Matrix4f scale(float s)
{
return Matrix4f::Scale(Vector3f(s,s,s),Vector3f::zero);
@ -108,6 +118,11 @@ namespace hgl
{
return rotate(angle,Vector3f(x,y,z));
}
inline Matrix4f rotate(float angle,float x,float y)
{
return rotate(angle,Vector3f(x,y,1.0f));
}
inline Matrix4f rotate(float angle,const Vector4f &axis)
{