cpe::navigator_tool Class Reference

(Dirty) Container class for camera, mouse and fps manipulation More...

Collaboration diagram for cpe::navigator_tool:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 navigator_tool ()
 empty constructor
unsigned int & screen_size_x ()
 Window size x.
const unsigned int & screen_size_x () const
 Window size x.
unsigned int & screen_size_y ()
 Window size y.
const unsigned int & screen_size_y () const
 Window size y.
double & dist_cam ()
 zoom factor
const double & dist_cam () const
 zoom factor
void go_forward (const double &dL)
 move the camera forward by a distance dL
void go_right (const double &dL)
 move the camera to the right by a distance dL
void go_up (const double &dL)
 move the camera up by a distance dL
void trackball_rotate (const int &x, const int &y)
 camera rotation using on-screen coordinates
void trackball_zoom (const int &y)
 camera zoom using on-screen coordinates
int & x_previous ()
 previous position of the mouse in screen x-coordinate
const int & x_previous () const
 previous position of the mouse in screen x-coordinate
int & y_previous ()
 previous position of the mouse in screen y-coordinate
const int & y_previous () const
 previous position of the mouse in screen y-coordinate
bool & left_button ()
 is left button clicked
const bool & left_button () const
 is left button clicked
bool & right_button ()
 is right button clicked
const bool & right_button () const
 is right button clicked
std::vector< double > projection_param () const
 Projection camera parameters: left/top/znear/zfar/aspect.
matrix3 camera_orientation ()
 get the camera orientation (matrix of the quaternion)
v3 camera_translation ()
 get the camera absolute translation
void increase_frame_number ()
 increase the frame number by 1
const unsigned int & time () const
 get the current elapsed time
unsigned int & time ()
 get the current elapsed time
double update_fps ()
 update the fps counter and set frame to 0
double delta_time ()
 elapsed time since old_time record
double fps ()
 get the current fps

Private Attributes

trackball track
 internal rotation quaternion controled using ArcBall
v3 tr
 internal camera world space translation
double dist
 internal zoom magnitude (z-translation in local coordinate frame)
double fov
 internal camera FOV storage
double znear
 internal camera Znear storage
double zfar
 internal camera Zfar storage
unsigned int x_size
 internal storage of window width
unsigned int y_size
 internal storage of window height
int mouse_x_previous
 internal storage of previous clicked position of the mouse (x)
int mouse_y_previous
 internal storage of previous clicked position of the mouse (y)
bool is_left_button
 internal storage when left button is clicked
bool is_right_button
 internal storage when right button is clicked
double current_fps
 internal storage of current fps
unsigned int current_time
 internal storage of current time
unsigned int old_time
 internal storage of previously recorded time
unsigned int frame
 internal storage of current frame number

Detailed Description

(Dirty) Container class for camera, mouse and fps manipulation

The camera is controled using 3 parameters:

1/ zoom factor (dist) = translation along local z coordinate

2/ orientation (track) = rotation transformation in this second frame controlled by arcball

3/ translation (tr) = final translation in the global world space


Constructor & Destructor Documentation

cpe::navigator_tool::navigator_tool (  ) 

empty constructor

References dist, fov, zfar, and znear.


Member Function Documentation

matrix3 cpe::navigator_tool::camera_orientation (  ) 

get the camera orientation (matrix of the quaternion)

References cpe::quaternion::conjugated(), cpe::quaternion::matrix(), cpe::trackball::quat(), and track.

Referenced by display_manager_begin(), draw_orientation(), and draw_pointer().

Here is the call graph for this function:

v3 cpe::navigator_tool::camera_translation (  ) 

get the camera absolute translation

References tr.

Referenced by display_manager_begin().

double cpe::navigator_tool::delta_time (  ) 

elapsed time since old_time record

References current_time, and old_time.

Referenced by display_manager_end().

const double & cpe::navigator_tool::dist_cam (  )  const

zoom factor

References dist.

double & cpe::navigator_tool::dist_cam (  ) 

zoom factor

References dist.

Referenced by display_manager_begin(), draw_pointer(), and keyboard_manager().

double cpe::navigator_tool::fps (  ) 

get the current fps

References current_fps.

Referenced by draw_fps().

void cpe::navigator_tool::go_forward ( const double &  dL  ) 

move the camera forward by a distance dL

References cpe::trackball::quat(), tr, and track.

Referenced by keyboard_manager().

Here is the call graph for this function:

void cpe::navigator_tool::go_right ( const double &  dL  ) 

move the camera to the right by a distance dL

References cpe::trackball::quat(), tr, and track.

Referenced by keyboard_manager().

Here is the call graph for this function:

void cpe::navigator_tool::go_up ( const double &  dL  ) 

move the camera up by a distance dL

References cpe::trackball::quat(), tr, and track.

Referenced by keyboard_manager().

Here is the call graph for this function:

void cpe::navigator_tool::increase_frame_number (  ) 

increase the frame number by 1

References frame.

Referenced by display_manager_end().

const bool & cpe::navigator_tool::left_button (  )  const

is left button clicked

References is_left_button.

bool & cpe::navigator_tool::left_button (  ) 

is left button clicked

References is_left_button.

Referenced by motion_manager(), and mouse_manager().

std::vector< double > cpe::navigator_tool::projection_param (  )  const

Projection camera parameters: left/top/znear/zfar/aspect.

for use: glFrustum(left, -left, top, -top, znear, zfar); with double aspect=static_cast<double>(navigator.x_screen_size_1)/static_cast<double>(navigator.y_screen_size_1); double fov=45.0*PI/180.0; double near=0.1; double top=tan(fov*0.5)*near; double bottom=-top; double left=aspect*bottom; double right=-left;

References fov, x_size, y_size, zfar, and znear.

Referenced by display_manager_begin().

const bool & cpe::navigator_tool::right_button (  )  const

is right button clicked

References is_right_button.

bool & cpe::navigator_tool::right_button (  ) 

is right button clicked

References is_right_button.

Referenced by motion_manager(), and mouse_manager().

const unsigned int & cpe::navigator_tool::screen_size_x (  )  const

Window size x.

References x_size.

unsigned int & cpe::navigator_tool::screen_size_x (  ) 

Window size x.

References x_size.

Referenced by display_manager_begin(), main(), reshape_manager(), and setup_opengl().

const unsigned int & cpe::navigator_tool::screen_size_y (  )  const

Window size y.

References y_size.

unsigned int & cpe::navigator_tool::screen_size_y (  ) 

Window size y.

References y_size.

Referenced by display_manager_begin(), main(), reshape_manager(), and setup_opengl().

unsigned int & cpe::navigator_tool::time (  ) 

get the current elapsed time

References current_time.

const unsigned int & cpe::navigator_tool::time (  )  const

get the current elapsed time

References current_time.

Referenced by display_manager_end().

void cpe::navigator_tool::trackball_rotate ( const int &  x,
const int &  y 
)

camera rotation using on-screen coordinates

References cpe::trackball::apply_rotation(), mouse_x_previous, mouse_y_previous, cpe::trackball::set_2d_coords(), track, x_size, and y_size.

Referenced by motion_manager().

Here is the call graph for this function:

void cpe::navigator_tool::trackball_zoom ( const int &  y  ) 

camera zoom using on-screen coordinates

References dist, and mouse_y_previous.

Referenced by motion_manager().

double cpe::navigator_tool::update_fps (  ) 

update the fps counter and set frame to 0

References current_fps, current_time, frame, and old_time.

Referenced by display_manager_end().

const int & cpe::navigator_tool::x_previous (  )  const

previous position of the mouse in screen x-coordinate

References mouse_x_previous.

int & cpe::navigator_tool::x_previous (  ) 

previous position of the mouse in screen x-coordinate

References mouse_x_previous.

Referenced by mouse_manager().

const int & cpe::navigator_tool::y_previous (  )  const

previous position of the mouse in screen y-coordinate

References mouse_y_previous.

int & cpe::navigator_tool::y_previous (  ) 

previous position of the mouse in screen y-coordinate

References mouse_y_previous.

Referenced by mouse_manager().


Member Data Documentation

internal storage of current fps

Referenced by fps(), and update_fps().

unsigned int cpe::navigator_tool::current_time [private]

internal storage of current time

Referenced by delta_time(), time(), and update_fps().

double cpe::navigator_tool::dist [private]

internal zoom magnitude (z-translation in local coordinate frame)

Referenced by dist_cam(), navigator_tool(), and trackball_zoom().

double cpe::navigator_tool::fov [private]

internal camera FOV storage

Referenced by navigator_tool(), and projection_param().

unsigned int cpe::navigator_tool::frame [private]

internal storage of current frame number

Referenced by increase_frame_number(), and update_fps().

internal storage when left button is clicked

Referenced by left_button().

internal storage when right button is clicked

Referenced by right_button().

internal storage of previous clicked position of the mouse (x)

Referenced by trackball_rotate(), and x_previous().

internal storage of previous clicked position of the mouse (y)

Referenced by trackball_rotate(), trackball_zoom(), and y_previous().

unsigned int cpe::navigator_tool::old_time [private]

internal storage of previously recorded time

Referenced by delta_time(), and update_fps().

internal camera world space translation

Referenced by camera_translation(), go_forward(), go_right(), and go_up().

internal rotation quaternion controled using ArcBall

Referenced by camera_orientation(), go_forward(), go_right(), go_up(), and trackball_rotate().

unsigned int cpe::navigator_tool::x_size [private]

internal storage of window width

Referenced by projection_param(), screen_size_x(), and trackball_rotate().

unsigned int cpe::navigator_tool::y_size [private]

internal storage of window height

Referenced by projection_param(), screen_size_y(), and trackball_rotate().

double cpe::navigator_tool::zfar [private]

internal camera Zfar storage

Referenced by navigator_tool(), and projection_param().

double cpe::navigator_tool::znear [private]

internal camera Znear storage

Referenced by navigator_tool(), and projection_param().


The documentation for this class was generated from the following files:
Generated on Fri Apr 1 17:22:45 2011 by  doxygen 1.6.3