columns[0] = compose(right, 0.0f);
columns[1] = compose(up, 0.0f);
columns[2] = compose(cross(right, up), 0.0f);
- columns[3] = compose(base_camera.get_position(), 1.0f);
- GL::Matrix matrix = GL::Matrix::from_columns(columns)*hmd_matrix;
+ columns[3] = compose(base_camera.get_position()+base_camera.get_up_direction()*elevation_offset, 1.0f);
+ base_matrix = GL::Matrix::from_columns(columns);
- set_position(matrix*GL::Vector3()+base_camera.get_up_direction()*elevation_offset);
+ GL::Matrix matrix = base_matrix*hmd_matrix;
+
+ set_position(matrix*GL::Vector3());
set_look_direction((matrix*GL::Vector4(0, 0, -1, 0)).slice<3>(0));
set_up_direction((matrix*GL::Vector4(0, 1, 0, 0)).slice<3>(0));
{
protected:
const GL::Camera &base_camera;
+ GL::Matrix base_matrix;
float elevation_offset;
HeadTrackingCamera(const GL::Camera &);
public:
virtual ~HeadTrackingCamera() { }
+ const GL::Matrix &get_base_matrix() const { return base_matrix; }
+
void set_elevation_offset(float);
virtual void reset_tracking() { }
virtual void update() = 0;