2018-09-10 01:20:56 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <glm/glm.hpp>
|
|
|
|
|
2018-09-12 21:03:46 +00:00
|
|
|
namespace charcoal
|
2018-09-10 01:20:56 +00:00
|
|
|
{
|
2018-09-12 21:03:46 +00:00
|
|
|
using namespace glm;
|
|
|
|
|
|
|
|
class Poseable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Assumes that forward, up, and right are orthogonal and normalized
|
|
|
|
Poseable(
|
|
|
|
const vec3& position = vec3(0.0f, 0.0f, 0.0f),
|
|
|
|
const vec3& forward = vec3(0.0f, 0.0f, 1.0f),
|
|
|
|
const vec3& up = vec3(0.0f, 1.0f, 0.0f),
|
|
|
|
const vec3& right = vec3(1.0f, 0.0f, 0.0f)
|
|
|
|
);
|
|
|
|
|
2018-10-08 19:19:48 +00:00
|
|
|
void reset_orientation();
|
|
|
|
|
2018-09-12 21:03:46 +00:00
|
|
|
void update_position(const vec3& position);
|
|
|
|
// Assumes that forward, up, and right are orthogonal and normalized
|
|
|
|
void update_orientation(const vec3& forward, const vec3& up, const vec3& right);
|
2018-09-10 01:20:56 +00:00
|
|
|
|
2018-09-12 21:03:46 +00:00
|
|
|
void translate(const vec3& translation);
|
|
|
|
void rotate(const vec3& axis, float angle);
|
2018-09-10 01:20:56 +00:00
|
|
|
|
2018-09-12 21:03:46 +00:00
|
|
|
const mat4& get_orientation_matrix() const { return m_orientation_matrix; }
|
2018-09-10 01:20:56 +00:00
|
|
|
|
2018-09-12 21:03:46 +00:00
|
|
|
protected:
|
|
|
|
mat4 m_orientation_matrix;
|
|
|
|
};
|
|
|
|
}
|