cat3d
A tiny OpenGL 3D engine library written in and for C++.
camera.hpp
1 #pragma once
2 
3 #include <glm/glm.hpp>
4 
5 #include "cat3d/scene.hpp"
6 
7 namespace cat3d::obj {
8 
15 class camera : public scene::node {
16 public:
24  camera(glm::vec3 pos, glm::vec3 aim, float fov = 75.f);
25 
31  void set_pos(glm::vec3 new_pos);
37  glm::vec3 get_pos() const;
38 
44  void set_aim(glm::vec3 new_aim);
50  glm::vec3 get_aim() const;
51 
52 protected:
53  void update_self(window& win);
54 
55 private:
57  glm::vec3 m_pos;
59  glm::vec3 m_aim;
61  float m_fov;
62 
64  glm::mat4 view_matrix() const;
66  glm::mat4 proj_matrix(window& win) const;
67 };
68 
69 }
cat3d::obj::camera::get_pos
glm::vec3 get_pos() const
Retrieve the camera's center.
cat3d::obj::camera::set_pos
void set_pos(glm::vec3 new_pos)
Set the camera's center.
cat3d::window
Manages internal window api / state.
Definition: window.hpp:17
cat3d::obj::camera::camera
camera(glm::vec3 pos, glm::vec3 aim, float fov=75.f)
Constructor.
cat3d::obj::camera::set_aim
void set_aim(glm::vec3 new_aim)
Set the location that the camera points towards.
cat3d::obj::camera::get_aim
glm::vec3 get_aim() const
Get the camera's currently focused point.
cat3d::obj::camera::update_self
void update_self(window &win)
Overridden by child classes to implement custom behavior.
cat3d::scene::node
Basic, semi-abstract scene node class. Can have children which are other scene nodes,...
Definition: node.hpp:28
cat3d::obj::camera
Node for managing the camera's perspective on the scene.
Definition: camera.hpp:15