diff --git a/src/osgPlugins/txp/TrPageParser.cpp b/src/osgPlugins/txp/TrPageParser.cpp index ba1fde1f0..67d68e249 100644 --- a/src/osgPlugins/txp/TrPageParser.cpp +++ b/src/osgPlugins/txp/TrPageParser.cpp @@ -493,8 +493,7 @@ void* lodRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) Vec3 osg_Center; osg_Center[0] = center.x; osg_Center[1] = center.y; osg_Center[2] = center.z; osg_Lod->setCenter(osg_Center); - osg_Lod->setRange(0,0.0, minRange); - osg_Lod->setRange(1,minRange, maxRange ); + osg_Lod->setRange(0,minRange, maxRange ); // Our LODs are binary so we need to add a group under this LOD and attach stuff // to that instead of the LOD @@ -846,7 +845,7 @@ bool TrPageParser::AddToGroupList(int ID,Group *group) // Initialize the group list void TrPageParser::SetMaxGroupID(int maxGroupID) { - notify(WARN) << "trpgFPParser: max group ID = " << maxGroupID << std::endl; + //notify(WARN) << "trpgFPParser: max group ID = " << maxGroupID << std::endl; // Initialize the group list with -1's groupList.resize(0); // Note: Fix this diff --git a/src/osgPlugins/txp/TrPageViewer.cpp b/src/osgPlugins/txp/TrPageViewer.cpp index d38915502..040d992f9 100644 --- a/src/osgPlugins/txp/TrPageViewer.cpp +++ b/src/osgPlugins/txp/TrPageViewer.cpp @@ -102,22 +102,10 @@ float PagingViewer::app(unsigned int viewport) { osg::Timer_t beforeApp = _timer.tick(); - // update the camera manipulator. osg::ref_ptr ea = osgNew GLUTEventAdapter; ea->adaptFrame(_frameStamp->getReferenceTime()); -#if 0 // This is the old way... - if (_viewportList[viewport]._eventHandler.valid() && _viewportList[viewport]._eventHandler->handle(*ea,*this)) - { - // event handler handle this call. - } - else if (_viewportList[viewport]._cameraManipulator->handle(*ea,*this)) - { - // osg::notify(osg::INFO) << "Handled update frame"<< std::endl; - } -#else // this is the new way - bool handled = false; for (EventHandlerList::iterator eh = _viewportList[viewport]._eventHandlerList.begin(); eh != _viewportList[viewport]._eventHandlerList.end(); eh++ ) @@ -131,11 +119,17 @@ float PagingViewer::app(unsigned int viewport) } } } -// if ( !handled ) { _viewportList[viewport]._cameraManipulator->handle(*ea,*this); -// } -#endif + if (getRecordingAnimationPath() && getAnimationPath()) + { + osg::Camera* camera = getViewportSceneView(viewport)->getCamera(); + osg::Matrix matrix; + matrix.invert(camera->getModelViewMatrix()); + osg::Quat quat; + quat.set(matrix); + getAnimationPath()->insert(_frameStamp->getReferenceTime(),osg::AnimationPath::ControlPoint(matrix.getTrans(),quat)); + } // Update the paging if (pageManage) { @@ -164,20 +158,6 @@ float PagingViewer::app(unsigned int viewport) osg::Timer_t beforeCull = _timer.tick(); -#if 0 -// We're going for 66ms per frame -float targetFrameTime = 30; - - static osg::Timer_t lastCull = 0; - if (lastCull > 0) { - float deltaT = _timer.delta_m(lastCull,beforeCull); - int extraTime = targetFrameTime - deltaT; - if (extraTime > 0) - Sleep(extraTime); - } - lastCull = beforeCull; -#endif - return _timer.delta_m(beforeApp,beforeCull); } diff --git a/src/osgPlugins/txp/trPagePageManager.cpp b/src/osgPlugins/txp/trPagePageManager.cpp index 2fb2b6870..59f570a35 100644 --- a/src/osgPlugins/txp/trPagePageManager.cpp +++ b/src/osgPlugins/txp/trPagePageManager.cpp @@ -212,12 +212,14 @@ bool OSGPageManager::StartThread(ThreadMode mode,ThreadID &newThread) // Was successfull if (newThread != NULL) threadMode = mode; -#endif +#else //locationChangeEvent is self-initialized. pthread_mutex_init( &changeListMutex, 0L ); pthread_mutex_init( &locationMutex, 0L ); - if( pthread_create( &newThread, 0L, ThreadFunc, (void *)this ) == 0 ) - threadMode = mode; + threadMode = mode; + if( pthread_create( &newThread, 0L, ThreadFunc, (void *)this ) != 0 ) + threadMode = ThreadNone; +#endif return threadMode != ThreadNone; } @@ -274,7 +276,7 @@ bool OSGPageManager::ThreadLoop() // Form the delete list first trpgManagedTile *tile=NULL; std::vector unhook; - while (tile = pageManage->GetNextUnload()) { + while ((tile = pageManage->GetNextUnload())) { unhook.push_back((Group *)tile->GetLocalData()); pageManage->AckUnload(); }