Fixes to txp loader

This commit is contained in:
Don BURNS
2002-11-29 16:14:03 +00:00
parent 4512ffd868
commit 97ec694e21
3 changed files with 17 additions and 36 deletions

View File

@@ -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

View File

@@ -102,22 +102,10 @@ float PagingViewer::app(unsigned int viewport)
{
osg::Timer_t beforeApp = _timer.tick();
// update the camera manipulator.
osg::ref_ptr<GLUTEventAdapter> 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);
}

View File

@@ -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<osg::Group *> unhook;
while (tile = pageManage->GetNextUnload()) {
while ((tile = pageManage->GetNextUnload())) {
unhook.push_back((Group *)tile->GetLocalData());
pageManage->AckUnload();
}