2021-11-30 21:29:18 -06:00
|
|
|
#include "transform.h"
|
|
|
|
#include <string.h>
|
|
|
|
|
2023-05-24 20:45:50 -05:00
|
|
|
struct mTransform MakeTransform(HMM_Vec3 pos, HMM_Quat rotation, float scale)
|
|
|
|
{
|
|
|
|
struct mTransform newT = {
|
|
|
|
.pos = pos,
|
|
|
|
.rotation = rotation,
|
|
|
|
.scale = scale
|
|
|
|
};
|
2023-05-12 13:22:05 -05:00
|
|
|
return newT;
|
2021-11-30 21:29:18 -06:00
|
|
|
}
|
|
|
|
|
2023-05-24 20:45:50 -05:00
|
|
|
HMM_Vec3 trans_forward(const struct mTransform *const trans)
|
|
|
|
{
|
|
|
|
return HMM_QVRot(vFWD, trans->rotation);
|
2021-11-30 21:29:18 -06:00
|
|
|
}
|
|
|
|
|
2023-05-24 20:45:50 -05:00
|
|
|
HMM_Vec3 trans_back(const struct mTransform *trans)
|
|
|
|
{
|
|
|
|
return HMM_QVRot(vBKWD, trans->rotation);
|
2021-11-30 21:29:18 -06:00
|
|
|
}
|
|
|
|
|
2023-05-24 20:45:50 -05:00
|
|
|
HMM_Vec3 trans_up(const struct mTransform *trans)
|
|
|
|
{
|
|
|
|
return HMM_QVRot(vUP, trans->rotation);
|
2021-11-30 21:29:18 -06:00
|
|
|
}
|
|
|
|
|
2023-05-24 20:45:50 -05:00
|
|
|
HMM_Vec3 trans_down(const struct mTransform *trans)
|
|
|
|
{
|
|
|
|
return HMM_QVRot(vDOWN, trans->rotation);
|
2021-11-30 21:29:18 -06:00
|
|
|
}
|
|
|
|
|
2023-05-24 20:45:50 -05:00
|
|
|
HMM_Vec3 trans_right(const struct mTransform *trans)
|
|
|
|
{
|
|
|
|
return HMM_QVRot(vRIGHT, trans->rotation);
|
2021-11-30 21:29:18 -06:00
|
|
|
}
|
|
|
|
|
2023-05-24 20:45:50 -05:00
|
|
|
HMM_Vec3 trans_left(const struct mTransform *trans)
|
|
|
|
{
|
|
|
|
return HMM_QVRot(vLEFT, trans->rotation);
|
2021-11-30 21:29:18 -06:00
|
|
|
}
|