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
|
|
|
}
|
2022-08-12 14:03:56 -05:00
|
|
|
|
|
|
|
#include "nuke.h"
|
|
|
|
|
2023-05-12 13:22:05 -05:00
|
|
|
void trans_drawgui(struct mTransform *T) {
|
2023-05-24 20:45:50 -05:00
|
|
|
nuke_property_float3("Position", -1000.f, T->pos.Elements, 1000.f, 1.f, 1.f);
|
|
|
|
nuke_property_float3("Rotation", 0.f, T->rotation.Elements, 360.f, 1.f, 0.1f);
|
2023-05-12 13:22:05 -05:00
|
|
|
nuke_property_float("Scale", 0.f, &T->scale, 1000.f, 0.1f, 0.1f);
|
2022-11-25 07:12:31 -06:00
|
|
|
}
|