First cut of osgDB::ImagePager for updating osg::ImageSequence

This commit is contained in:
Robert Osfield
2008-07-21 09:47:39 +00:00
parent d17a255d8e
commit d12708e6f6
8 changed files with 70 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ SET(LIB_PUBLIC_HEADERS
${HEADER_PATH}/FileNameUtils
${HEADER_PATH}/FileUtils
${HEADER_PATH}/ImageOptions
${HEADER_PATH}/ImagePager
${HEADER_PATH}/Input
${HEADER_PATH}/Output
${HEADER_PATH}/ParameterOutput
@@ -46,6 +47,7 @@ ADD_LIBRARY(${LIB_NAME}
FileNameUtils.cpp
FileUtils.cpp
ImageOptions.cpp
ImagePager.cpp
Input.cpp
Output.cpp
ReadFile.cpp

View File

@@ -1,3 +1,16 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osgDB/DatabasePager>
#include <osgDB/WriteFile>
#include <osgDB/FileNameUtils>

View File

@@ -972,6 +972,12 @@ void CompositeViewer::updateTraversal()
scene->getDatabasePager()->updateSceneGraph(_frameStamp->getReferenceTime());
}
if (scene->getImagePager())
{
// synchronize changes required by the DatabasePager thread to the scene graph
scene->getImagePager()->updateSceneGraph(_frameStamp->getReferenceTime());
}
}
if (_updateOperations.valid())

View File

@@ -24,6 +24,7 @@ Scene::Scene():
osg::Referenced(true)
{
setDatabasePager(osgDB::DatabasePager::create());
setImagePager(new osgDB::ImagePager);
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_sceneCacheMutex);
s_sceneCache.push_back(this);
@@ -71,6 +72,11 @@ void Scene::setDatabasePager(osgDB::DatabasePager* dp)
_databasePager = dp;
}
void Scene::setImagePager(osgDB::ImagePager* ip)
{
_imagePager = ip;
}
Scene* Scene::getScene(osg::Node* node)
{

View File

@@ -298,6 +298,22 @@ const osgDB::DatabasePager* View::getDatabasePager() const
}
void View::setImagePager(osgDB::ImagePager* dp)
{
_scene->setImagePager(dp);
}
osgDB::ImagePager* View::getImagePager()
{
return _scene->getImagePager();
}
const osgDB::ImagePager* View::getImagePager() const
{
return _scene->getImagePager();
}
void View::setCameraManipulator(osgGA::MatrixManipulator* manipulator)
{
_cameraManipulator = manipulator;

View File

@@ -891,6 +891,12 @@ void Viewer::updateTraversal()
_scene->getDatabasePager()->updateSceneGraph(_frameStamp->getReferenceTime());
}
if (_scene->getImagePager())
{
// synchronize changes required by the DatabasePager thread to the scene graph
_scene->getImagePager()->updateSceneGraph(_frameStamp->getReferenceTime());
}
if (_updateOperations.valid())
{
_updateOperations->runOperations(this);