MVE - Multi-View Environment mve-devel
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ogl::CameraContext< CTRL > Class Template Reference

A simple context that does some of the common annoying work. More...

#include <context.h>

Collaboration diagram for ogl::CameraContext< CTRL >:
Collaboration graph
[legend]

Public Member Functions

 CameraContext (void)
 
 ~CameraContext (void)
 
bool keyboard_event (KeyboardEvent const &event)
 Injects a keyboard event to the context.
 
bool mouse_event (MouseEvent const &event)
 Injects a mouse event to the context.
 
- Public Member Functions inherited from ogl::Context
virtual ~Context (void)
 
int get_height (void) const
 Returns the height of the viewport.
 
int get_width (void) const
 Returns the width of the viewport.
 
void init (void)
 Initializes the context.
 
void paint (void)
 Paints the frame.
 
void resize (int new_width, int new_height)
 Resizes the context.
 

Protected Member Functions

void resize_impl (int old_width, int old_height)
 Overwrite to define actions on resize.
 
void update_camera (void)
 
- Protected Member Functions inherited from ogl::Context
virtual void init_impl (void)=0
 Overwrite to define actions on init.
 
virtual void paint_impl (void)=0
 Overwrite to define actions on paint.
 

Protected Attributes

Camera camera
 
CTRL controller
 
- Protected Attributes inherited from ogl::Context
int height
 
int width
 

Detailed Description

template<typename CTRL>
class ogl::CameraContext< CTRL >

A simple context that does some of the common annoying work.

This context handles OpenGL resize events and calls OpenGL viewport commands and updates the projection matrix.

This context gets a controller as template parameter. The controller receives events and provides viewport parameters to update the camera. The controller is required to support the following operations:

TODO: Update camera in controller?

Definition at line 102 of file context.h.

Constructor & Destructor Documentation

◆ CameraContext()

template<typename CTRL >
ogl::CameraContext< CTRL >::CameraContext ( void  )
inline

Definition at line 176 of file context.h.

◆ ~CameraContext()

template<typename CTRL >
ogl::CameraContext< CTRL >::~CameraContext ( void  )
inline

Definition at line 183 of file context.h.

Member Function Documentation

◆ keyboard_event()

template<typename CTRL >
bool ogl::CameraContext< CTRL >::keyboard_event ( KeyboardEvent const &  event)
virtual

Injects a keyboard event to the context.

Default implementation prints debug information only.

Reimplemented from ogl::Context.

Definition at line 239 of file context.h.

◆ mouse_event()

template<typename CTRL >
bool ogl::CameraContext< CTRL >::mouse_event ( MouseEvent const &  event)
virtual

Injects a mouse event to the context.

Default implementation prints debug information only.

Reimplemented from ogl::Context.

Definition at line 230 of file context.h.

◆ resize_impl()

template<typename CTRL >
void ogl::CameraContext< CTRL >::resize_impl ( int  old_width,
int  old_height 
)
protectedvirtual

Overwrite to define actions on resize.

Implements ogl::Context.

Definition at line 189 of file context.h.

◆ update_camera()

template<typename CTRL >
void ogl::CameraContext< CTRL >::update_camera ( void  )
protected

Definition at line 217 of file context.h.

Member Data Documentation

◆ camera

template<typename CTRL >
Camera ogl::CameraContext< CTRL >::camera
protected

Definition at line 105 of file context.h.

◆ controller

template<typename CTRL >
CTRL ogl::CameraContext< CTRL >::controller
protected

Definition at line 106 of file context.h.


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