2bdc165572
Poseable is not a struct because it has a vtable. This means that it cannot be used easily with glVertexAttribPointer. This quick fix should be overwritten by a full fix that stores the matrix data in a seperate vector and modifies the matrices with poseable interfaces. (Will go into more detail in that commit.)
29 lines
862 B
C++
29 lines
862 B
C++
#pragma once
|
|
|
|
#include <glm/glm.hpp>
|
|
|
|
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)
|
|
);
|
|
|
|
virtual void update_position(const vec3& position);
|
|
// Assumes that forward, up, and right are orthogonal and normalized
|
|
virtual void update_orientation(const vec3& forward, const vec3& up, const vec3& right);
|
|
|
|
virtual void translate(const vec3& translation);
|
|
virtual void rotate(const vec3& axis, float angle);
|
|
|
|
const mat4& get_orientation_matrix() const { return m_orientation_matrix; }
|
|
|
|
// Please dont use this. If you see it, tell michael that he is bad
|
|
mat4 m_orientation_matrix;
|
|
}; |