cat3d
A tiny OpenGL 3D engine library written in and for C++.
Public Member Functions | Protected Member Functions | List of all members
cat3d::obj::camera Class Reference

Node for managing the camera's perspective on the scene. More...

#include <camera.hpp>

Inherits cat3d::scene::node.

Public Member Functions

 camera (glm::vec3 pos, glm::vec3 aim, float fov=75.f)
 Constructor. More...
 
void set_pos (glm::vec3 new_pos)
 Set the camera's center. More...
 
glm::vec3 get_pos () const
 Retrieve the camera's center. More...
 
void set_aim (glm::vec3 new_aim)
 Set the location that the camera points towards. More...
 
glm::vec3 get_aim () const
 Get the camera's currently focused point. More...
 
- Public Member Functions inherited from cat3d::scene::node
virtual ~node ()
 virtual destructor for polymorphism
 
void delete_child (node *child)
 Remove the given child node. More...
 
util::transform global_transform () const
 Get this node's transform relative to the world.
 
util::transform local_transform () const
 Get the node's transform relative to itself.
 
util::transformtransform ()
 Access to the underlying transform. More...
 
void update (window &win)
 Called once per frame. Updates this node.
 
void render (window &win)
 Called once per render. Renders this node and all children.
 
nodeparent () const
 Get this node's parent. More...
 
nodecreate_node ()
 Create a child node. More...
 
template<typename Obj , typename... Args>
Obj * create (Args... args)
 Add a derived node class as a child. More...
 
size_t bind (node_bind_loc loc, std::function< void()> fn)
 Add a hook into the update cycle of the node. More...
 
void unbind (size_t id)
 Unbind a hook from the node. More...
 

Protected Member Functions

void update_self (window &win)
 Overridden by child classes to implement custom behavior. More...
 
- Protected Member Functions inherited from cat3d::scene::node
virtual void render_self (window &win)
 Overridden by child classes to implement custom rendering. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from cat3d::scene::node
static nodenew_root ()
 Create a new root scene node. More...
 

Detailed Description

Node for managing the camera's perspective on the scene.

Remarks
Typically you only ever want one of these.

Constructor & Destructor Documentation

◆ camera()

cat3d::obj::camera::camera ( glm::vec3  pos,
glm::vec3  aim,
float  fov = 75.f 
)

Constructor.

Parameters
posThe position of the camera
aimWhere the camera should aim
fovThe FOV of the camera.

Member Function Documentation

◆ get_aim()

glm::vec3 cat3d::obj::camera::get_aim ( ) const

Get the camera's currently focused point.

Returns
glm::vec3

◆ get_pos()

glm::vec3 cat3d::obj::camera::get_pos ( ) const

Retrieve the camera's center.

Returns
glm::vec3

◆ set_aim()

void cat3d::obj::camera::set_aim ( glm::vec3  new_aim)

Set the location that the camera points towards.

Parameters
new_aim

◆ set_pos()

void cat3d::obj::camera::set_pos ( glm::vec3  new_pos)

Set the camera's center.

Parameters
new_pos

◆ update_self()

void cat3d::obj::camera::update_self ( window win)
protectedvirtual

Overridden by child classes to implement custom behavior.

Parameters
winThe main cat3d window.

Reimplemented from cat3d::scene::node.


The documentation for this class was generated from the following file: