Added LerpQuat/SLerpQuat/Blend(Transform)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include<hgl/math/Matrix.h>
|
||||
#include<hgl/math/Matrix.h>
|
||||
|
||||
// Vulkan Cookbook
|
||||
// ISBN: 9781786468154
|
||||
@@ -167,4 +167,15 @@ namespace hgl
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Transform Blend(const Transform &from,const Transform &to,const float t)
|
||||
{
|
||||
Transform result;
|
||||
|
||||
result.SetTranslation( from.GetTranslation()*(1.0f-t) + to.GetTranslation() *t);
|
||||
result.SetRotation( SLerpQuat(from.GetRotationQuat(),to.GetRotationQuat(),t));
|
||||
result.SetScale( from.GetScale() *(1.0f-t) + to.GetScale() *t);
|
||||
|
||||
return result;
|
||||
}
|
||||
}//namespace hgl
|
||||
|
Reference in New Issue
Block a user