1
0
Fork 0

Reset work, fix time-slew on OSG event handling.

This commit is contained in:
James Turner 2014-01-13 14:46:38 +00:00
parent 606643a199
commit 4d0eeb8184
2 changed files with 14 additions and 8 deletions

View file

@ -1022,14 +1022,15 @@ void fgStartNewReset()
globals->set_renderer(render);
render->init();
render->setViewer(viewer.get());
viewer->getDatabasePager()->setUpThreads(1, 1);
// must do this before splashinit for Rembrandt
flightgear::CameraGroup::buildDefaultGroup(viewer.get());
render->splashinit();
flightgear::CameraGroup::buildDefaultGroup(viewer.get());
fgOSResetProperties();
// init some things manually
// which do not follow the regular init pattern

View file

@ -433,9 +433,9 @@ FGRenderer::~FGRenderer()
}
// replace the viewer's scene completely
if (getViewer())
if (getViewer()) {
getViewer()->setSceneData(new osg::Group);
}
#ifdef FG_JPEG_SERVER
jpgRenderFrame = NULL;
@ -448,11 +448,15 @@ FGRenderer::~FGRenderer()
// critical parts of the scene graph in addition to the splash screen.
void
FGRenderer::splashinit( void )
{
{
// important that we reset the viewer sceneData here, to ensure the reference
// time for everything is in sync; otherwise on reset the Viewer and
// GraphicsWindow clocks are out of sync.
osgViewer::Viewer* viewer = getViewer();
viewer->setName("osgViewer");
_viewerSceneRoot = dynamic_cast<osg::Group*>(viewer->getSceneData());
_viewerSceneRoot = new osg::Group;
_viewerSceneRoot->setName("viewerSceneRoot");
viewer->setSceneData(_viewerSceneRoot);
ref_ptr<Node> splashNode = fgCreateSplashNode();
if (_classicalRenderer) {
@ -470,7 +474,8 @@ FGRenderer::splashinit( void )
}
}
_frameStamp = viewer->getFrameStamp();
_frameStamp = new osg::FrameStamp;
viewer->setFrameStamp(_frameStamp.get());
// Scene doesn't seem to pass the frame stamp to the update
// visitor automatically.
_updateVisitor->setFrameStamp(_frameStamp.get());