本文整理汇总了C++中osgviewer::Viewer::getStartTick方法的典型用法代码示例。如果您正苦于以下问题:C++ Viewer::getStartTick方法的具体用法?C++ Viewer::getStartTick怎么用?C++ Viewer::getStartTick使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osgviewer::Viewer
的用法示例。
在下文中一共展示了Viewer::getStartTick方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startTiming
/// Utility function you call before something you want to time, so that the
/// recorded times will all be consistent using the viewer's time.
void startTiming(osgViewer::Viewer& viewer, const std::string& name)
{
osg::Timer_t tick = osg::Timer::instance()->tick();
double currentTime = osg::Timer::instance()->delta_s(viewer.getStartTick(), tick);
int framenumber = viewer.getFrameStamp()->getFrameNumber();
viewer.getViewerStats()->setAttribute(framenumber, name + " begin", currentTime);
}
示例2: endTiming
/// Utility function you call after something you want to time, so that the
/// recorded times will all be consistent using the viewer's time.
void endTiming(osgViewer::Viewer& viewer, const std::string& name)
{
osg::Timer_t tick = osg::Timer::instance()->tick();
double currentTime = osg::Timer::instance()->delta_s(viewer.getStartTick(), tick);
int framenumber = viewer.getFrameStamp()->getFrameNumber();
viewer.getViewerStats()->setAttribute(framenumber, name + " end", currentTime);
double begin = 0.0;
double elapsed = 0.0;
if (viewer.getViewerStats()->getAttribute(framenumber, name + " begin", begin))
{
elapsed = currentTime - begin;
}
viewer.getViewerStats()->setAttribute(framenumber, name + " time taken", elapsed);
}