pose.h 603 Bytes
Newer Older
TheNumbat's avatar
TheNumbat committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

#pragma once

#include <set>
#include "../lib/mathlib.h"
#include "../geometry/spline.h"

struct Pose {
	Vec3 pos;
	Vec3 euler;
	Vec3 scale = Vec3{1.0f};

	Mat4 transform() const;
	Mat4 rotation_mat() const;
	Quat rotation_quat() const;

	void clamp_euler();
	bool valid() const;

	static Pose rotated(Vec3 angles);
	static Pose moved(Vec3 t);
	static Pose scaled(Vec3 s);
	static Pose id();
};

bool operator==(const Pose& l, const Pose& r);
bool operator!=(const Pose& l, const Pose& r);

struct Anim_Pose {
	Pose at(float t) const;
	void set(float t, Pose p);
	Splines<Vec3, Quat, Vec3> splines;
};