GEL
2
GEL is a library for Geometry and Linear Algebra
|
#include <GLViewController.h>
Public Member Functions | |
GLViewController (int _WINX, int _WINY, const CGLA::Vec3f &_centre, float _rad) | |
void | grab_ball (TrackBallAction action, const CGLA::Vec2i &pos) |
Grab ball takes an action and a mouse position. | |
void | roll_ball (const CGLA::Vec2i &pos) |
Roll virtual trackball (pass just mouse position). | |
void | release_ball () |
Release the virtual trackball. | |
bool | try_spin () |
Try to spind the trackball - called from idle. | |
void | set_gl_modelview () |
Setup GL modelview matrix. | |
void | reset_projection () |
Reset projection. Called initially, when window size has changed or when user zooms. | |
void | reshape (int W, int H) |
Reshape window. | |
void | set_near_and_far () |
Set near and far planes. | |
void | set_centre (const CGLA::Vec3f &c) |
Set centre of ball. | |
void | set_rotation (const CGLA::Quatf &qrot) |
void | set_eye_dist (float rad) |
Set eye distance. | |
float | get_eye_dist () const |
Returns eye distance. | |
void | get_view_param (CGLA::Vec3f &e, CGLA::Vec3f &c, CGLA::Vec3f &u) const |
Get viewing parameters: eye, centre, up. | |
bool | load (std::ifstream &) |
Load trackball from stream. | |
bool | save (std::ofstream &) const |
Save trackball to stream. |
The GLViewController is a more high level component than a trackball. The idea behind GLViewController is to handle setting up the projection and changing the viewport when the window is reshaped. Basically the raw mouse position and related info is sent to the view controller which takes care of the rest.
GLGraphics::GLViewController::GLViewController | ( | int | _WINX, |
int | _WINY, | ||
const CGLA::Vec3f & | _centre, | ||
float | _rad | ||
) |
Constructor which accepts the window dimensions as well as the world center and the radius which should be construed as the distance to the observer