23 lines
556 B
C++
23 lines
556 B
C++
#pragma once
|
|
#include <glm/glm.hpp>
|
|
#include <glm/gtc/quaternion.hpp>
|
|
|
|
struct Transform {
|
|
glm::vec3 pos;
|
|
glm::quat rot;
|
|
glm::vec3 scl;
|
|
};
|
|
|
|
inline Transform MixTransforms(const Transform& t1, const Transform& t2, float t) {
|
|
Transform ret;
|
|
ret.pos = glm::mix(t1.pos, t2.pos, t);
|
|
ret.rot = glm::slerp(t1.rot, t2.rot, t);
|
|
ret.scl = glm::mix(t1.scl, t2.scl, t);
|
|
return ret;
|
|
}
|
|
|
|
inline void IdentityTransform(Transform& t) {
|
|
t.pos = glm::vec3(0.0f);
|
|
t.rot = glm::quat(1.0f, 0.0f, 0.0f, 0.0f);
|
|
t.scl = glm::vec3(1.0f);
|
|
} |