Added AXIS, GetAxisVector

This commit is contained in:
2024-07-29 13:38:25 +08:00
parent e8b5f2a477
commit 2393bb43dc
2 changed files with 32 additions and 2 deletions

View File

@@ -179,7 +179,7 @@ namespace hgl
{
return glm::slerp(from,to,t);
}
inline Vector3f TransformPosition(const Matrix4f &m,const Vector3f &v)
{
return Vector3f(m*Vector4f(v,1.0f));
@@ -318,7 +318,7 @@ namespace hgl
matrix_dirty=true;
}
void SetRotation(const Vector3f &axis,float angle)
void SetRotation(const Vector3f &axis,const float angle)
{
rotation_axis=axis;
rotate_angle=angle;
@@ -331,6 +331,19 @@ namespace hgl
UpdateQuat();
}
void SetRotation(const AXIS &axis,const float angle)
{
rotation_axis=GetAxisVector(axis);
rotate_angle=angle;
UpdateQuat();
}
void SetRotationAxis(const AXIS &axis)
{
rotation_axis=GetAxisVector(axis);
UpdateQuat();
}
void SetRotateAngle(float angle)
{
rotate_angle=angle;