charcoal/OpenGLEngine/Poseable.h
elipzer 56af508ef4 Bouncing works... Kindof...
Need to fix for bottom and left cases
2018-10-17 19:53:36 -04:00

38 lines
1.0 KiB
C++

#pragma once
#include <glm/glm.hpp>
namespace charcoal
{
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)
);
void reset_orientation();
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);
void translate(const vec3& translation);
void rotate(const vec3& axis, float angle);
void set_orientation_matrix(const mat4& orientation_matrix) { m_orientation_matrix = orientation_matrix; }
const mat4& get_orientation_matrix() const { return m_orientation_matrix; }
vec3 get_position() const { return vec3(m_orientation_matrix[3][0], m_orientation_matrix[3][1], m_orientation_matrix[3][2]); }
protected:
mat4 m_orientation_matrix;
};
}