#include <osgGtkmm/ViewerGtkmm.h>
Public Member Functions | |
ViewerGtkmm () | |
ViewerGtkmm (osg::ArgumentParser &arguments) | |
ViewerGtkmm (const osgViewer::Viewer &viewer, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY) | |
virtual | ~ViewerGtkmm () |
If running, stops the viewer. | |
virtual bool | isSameKindAs (const osg::Object *object) const |
virtual const char * | libraryName () const |
virtual const char * | className () const |
GraphicsWindowGtkmm * | setup_viewer_in_gtkmm_window (int width, int height) |
Sets up this viewer to run in a Gtkmm window of the specified width and height. | |
virtual int | run () |
Starts the viewer running at the currently set frame interval and priority. | |
int | run_to_frame (int frame_num) |
Runs the viewer until the viewer's OSG frame stamp reaches frame_num. | |
int | run_frames (int frames) |
Runs the viewer until the viewer's OSG frame stamp reaches the current frame stamp + frames. | |
virtual void | stop () |
Stops the viewer from running. | |
bool | is_running () |
True if the viewer is running, false otherwise. | |
double | fps () |
Returns the frames-per-second rate based on the currently set frame interval. | |
void | set_fps (double fps) |
Sets the frames per second update rate. | |
unsigned | frame_interval_ms () |
Returns the frame interval in milliseconds that will be used when the viewer is running. | |
void | set_frame_interval_ms (unsigned interval) |
Sets the frame interval in milliseconds that will be used when the viewer is running. | |
int | run_priority () |
Returns the run priority that will be used when the viewer is running. | |
void | set_run_priority (int priority) |
Sets the run priority that will be used when the viewer is running. | |
double | running_frame_step_rate () |
Returns the frame step rate that will be used when the viewer is running. | |
void | set_running_frame_step_rate (double frame_rate) |
Sets the frame step rate that will be used when the viewer is running. | |
int | get_run_to_frame_number () |
Returns the frame number that the viewer will run to. | |
Protected Member Functions | |
bool | on_graphics_window_expose_event (GdkEventExpose *event) |
virtual int | on_run_step () |
void | connect_timer () |
virtual int | run_implementation () |
Protected Attributes | |
bool | m_is_running |
unsigned | m_frame_interval |
int | m_run_priority |
double | m_frame_step_rate |
int | m_run_to_frame_number |
sigc::connection | m_timer_connection |
Private Member Functions | |
int | on_run_step_proxy () |
Proxy callback point that passes the callback to the virtual on_run_step(). |
In particular, the ability to establish this viewer in a gtkmm graphics window with the convenience method setup_viewer_in_gtkmm_window().
Also reimplements run() to use the glibmm timer main loop
osgViewer::ViewerGtkmm::ViewerGtkmm | ( | ) |
osgViewer::ViewerGtkmm::ViewerGtkmm | ( | osg::ArgumentParser & | arguments | ) |
osgViewer::ViewerGtkmm::ViewerGtkmm | ( | const osgViewer::Viewer & | viewer, | |
const osg::CopyOp & | copyop = osg::CopyOp::SHALLOW_COPY | |||
) |
osgViewer::ViewerGtkmm::~ViewerGtkmm | ( | ) | [virtual] |
const char * osgViewer::ViewerGtkmm::className | ( | ) | const [virtual] |
void osgViewer::ViewerGtkmm::connect_timer | ( | ) | [protected] |
References m_frame_interval, m_run_priority, m_timer_connection, and on_run_step_proxy().
Referenced by run_implementation(), set_fps(), set_frame_interval_ms(), and set_run_priority().
double osgViewer::ViewerGtkmm::fps | ( | ) |
Returns the frames-per-second rate based on the currently set frame interval.
References m_frame_interval.
unsigned osgViewer::ViewerGtkmm::frame_interval_ms | ( | ) |
Returns the frame interval in milliseconds that will be used when the viewer is running.
References m_frame_interval.
int osgViewer::ViewerGtkmm::get_run_to_frame_number | ( | ) |
bool osgViewer::ViewerGtkmm::is_running | ( | ) |
True if the viewer is running, false otherwise.
References m_is_running.
Referenced by set_fps(), set_frame_interval_ms(), set_run_priority(), and ~ViewerGtkmm().
bool osgViewer::ViewerGtkmm::isSameKindAs | ( | const osg::Object * | object | ) | const [virtual] |
const char * osgViewer::ViewerGtkmm::libraryName | ( | ) | const [virtual] |
bool osgViewer::ViewerGtkmm::on_graphics_window_expose_event | ( | GdkEventExpose * | event | ) | [protected] |
Referenced by setup_viewer_in_gtkmm_window().
int osgViewer::ViewerGtkmm::on_run_step | ( | ) | [protected, virtual] |
int osgViewer::ViewerGtkmm::on_run_step_proxy | ( | ) | [private] |
Proxy callback point that passes the callback to the virtual on_run_step().
References on_run_step().
Referenced by connect_timer().
int osgViewer::ViewerGtkmm::run | ( | ) | [virtual] |
Starts the viewer running at the currently set frame interval and priority.
Runs until stopped
References m_run_to_frame_number, and run_implementation().
int osgViewer::ViewerGtkmm::run_frames | ( | int | frames | ) |
Runs the viewer until the viewer's OSG frame stamp reaches the current frame stamp + frames.
References m_run_to_frame_number, and run_implementation().
int osgViewer::ViewerGtkmm::run_implementation | ( | ) | [protected, virtual] |
References connect_timer(), m_is_running, and m_timer_connection.
Referenced by run(), run_frames(), and run_to_frame().
int osgViewer::ViewerGtkmm::run_priority | ( | ) |
int osgViewer::ViewerGtkmm::run_to_frame | ( | int | frame_num | ) |
Runs the viewer until the viewer's OSG frame stamp reaches frame_num.
References m_run_to_frame_number, and run_implementation().
double osgViewer::ViewerGtkmm::running_frame_step_rate | ( | ) |
Returns the frame step rate that will be used when the viewer is running.
This is the value that will be passed to osgViewer::Viewer::advance() and controls the rate at which the viewer is advanced.
References m_frame_step_rate.
void osgViewer::ViewerGtkmm::set_fps | ( | double | fps | ) |
Sets the frames per second update rate.
Since the update interval has a resolution of 1ms, the update interval may not be exactly the same as the set rate.
For example, if set_fps(60) is called the actual update rate will not be 16.66667 ms (1000 ms / 60). Instead, the update rate will be the floor of 1000/60 or 16ms. Thus, the actual frame rate will be 62.5 fps.
References connect_timer(), is_running(), and m_frame_interval.
void osgViewer::ViewerGtkmm::set_frame_interval_ms | ( | unsigned | interval | ) |
Sets the frame interval in milliseconds that will be used when the viewer is running.
References connect_timer(), is_running(), and m_frame_interval.
void osgViewer::ViewerGtkmm::set_run_priority | ( | int | priority | ) |
Sets the run priority that will be used when the viewer is running.
References connect_timer(), is_running(), and m_run_priority.
void osgViewer::ViewerGtkmm::set_running_frame_step_rate | ( | double | frame_rate | ) |
Sets the frame step rate that will be used when the viewer is running.
References m_frame_step_rate.
GraphicsWindowGtkmm * osgViewer::ViewerGtkmm::setup_viewer_in_gtkmm_window | ( | int | width, | |
int | height | |||
) |
Sets up this viewer to run in a Gtkmm window of the specified width and height.
References on_graphics_window_expose_event().
void osgViewer::ViewerGtkmm::stop | ( | ) | [virtual] |
Stops the viewer from running.
References m_is_running, and m_timer_connection.
Referenced by on_run_step(), and ~ViewerGtkmm().
unsigned osgViewer::ViewerGtkmm::m_frame_interval [protected] |
Referenced by connect_timer(), fps(), frame_interval_ms(), set_fps(), and set_frame_interval_ms().
double osgViewer::ViewerGtkmm::m_frame_step_rate [protected] |
Referenced by on_run_step(), running_frame_step_rate(), and set_running_frame_step_rate().
bool osgViewer::ViewerGtkmm::m_is_running [protected] |
Referenced by is_running(), run_implementation(), and stop().
int osgViewer::ViewerGtkmm::m_run_priority [protected] |
Referenced by connect_timer(), run_priority(), and set_run_priority().
int osgViewer::ViewerGtkmm::m_run_to_frame_number [protected] |
Referenced by get_run_to_frame_number(), on_run_step(), run(), run_frames(), and run_to_frame().
sigc::connection osgViewer::ViewerGtkmm::m_timer_connection [protected] |
Referenced by connect_timer(), run_implementation(), and stop().