GEL
2
GEL is a library for Geometry and Linear Algebra
|
Simple trackball class. More...
#include <SimpleTrackBall.h>
Public Member Functions | |
SimpleTrackBall (const CGLA::Vec3f &_center, float _r) | |
void | gl_view () const |
void | get_view (CGLA::Vec3f &c, CGLA::Vec3f &e, CGLA::Vec3f &u) |
void | up_axis (char up) |
void | farther () |
void | closer () |
void | roll (int x, int y) |
void | set_center (const CGLA::Vec3f &_center) |
Simple trackball class.
Use it to let the mouse movement control the viewing transformation.
Typical usage: Construct the trackball as a global variable. Call the roll function from the GLUT mouse motion callback. Setup an idle callback which only calls glutPostRedisplay and call gl_view from the display function to set up the view transform.
Deficiencies: This trackball has many shortcomings. For instance you cannot pan but only zoom and rotate. Go fix those problems!
GLGraphics::SimpleTrackBall::SimpleTrackBall | ( | const CGLA::Vec3f & | _center, |
float | _r | ||
) | [inline] |
Constructor. Call with the distance to the center.
void GLGraphics::SimpleTrackBall::closer | ( | ) | [inline] |
Move closer. Typically called from the keyboard callback
void GLGraphics::SimpleTrackBall::farther | ( | ) | [inline] |
Move away. Typically called from the keyboard callback
void GLGraphics::SimpleTrackBall::gl_view | ( | ) | const |
Callthis to set up OpenGL viewing matrix. It will also clear the view matrix.
Call this to set up OpenGL viewing matrix. It will also clear the view matrix.
void GLGraphics::SimpleTrackBall::roll | ( | int | x, |
int | y | ||
) |
Roll ball. Call with the x,y coordinates. This function is typically called from GLUT's mouse motion callback.