Added control of auto option into slideshow3D

This commit is contained in:
Robert Osfield 2003-07-23 15:12:52 +00:00
parent b925dcabaa
commit 46680be5eb
4 changed files with 25 additions and 9 deletions

View File

@ -53,7 +53,7 @@ void SlideEventHandler::set(osg::Node* model)
}
else
{
std::cout<<"Not found presentation "<<std::endl;
std::cout<<"No presentation present in scene."<<std::endl;
_presentationSwitch = 0;
_activeSlide = 0;
@ -70,7 +70,7 @@ void SlideEventHandler::set(osg::Node* model)
}
else
{
std::cout<<"Not found slide either "<<std::endl;
std::cout<<"No slides present in scene, unable to operate as a slideshow."<<std::endl;
}
}

View File

@ -53,6 +53,12 @@ public:
bool nextLayer();
bool previousLayer();
void setAutoSteppingActive(bool flag) { _autoSteppingActive = true; }
bool getAutoSteppingActive() const { return _autoSteppingActive; }
void setTimeDelayBetweenSlides(double dt) { _timePerSlide = dt; }
double getTimeDelayBetweenSlides() const { return _timePerSlide; }
protected:
~SlideEventHandler() {}

View File

@ -39,10 +39,20 @@ int main( int argc, char **argv )
// get details on keyboard and mouse bindings used by the viewer.
viewer.getUsage(*arguments.getApplicationUsage());
// read any time delay argument.
float timeDelayBetweenSlides = 1.5f;
while (arguments.read("-d",timeDelayBetweenSlides)) {}
bool autoSteppingActive = false;
while (arguments.read("-a")) autoSteppingActive = true;
// register the slide event handler - which moves the presentation from slide to slide, layer to layer.
SlideEventHandler* seh = new SlideEventHandler;
viewer.getEventHandlerList().push_front(seh);
seh->setAutoSteppingActive(autoSteppingActive);
seh->setTimeDelayBetweenSlides(timeDelayBetweenSlides);
// if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))
{
@ -66,11 +76,11 @@ int main( int argc, char **argv )
// read the scene from the list of file specified commandline args.
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
// if no model loaded create a default presentation.
if (!loadedModel)
{
loadedModel = createDefaultPresentation();
}
// // if no model loaded create a default presentation.
// if (!loadedModel)
// {
// loadedModel = createDefaultPresentation();
// }
// if no model has been successfully loaded report failure.

View File

@ -4,10 +4,10 @@ osgversion
echo osglogo
osglogo
echo slideshow3D introduction.xml
echo slideshow3D -a introduction.xml
slideshow3D introduction.xml
echo slideshow3D models.xml
echo slideshow3D -a models.xml
slideshow3D models.xml
echo osgviewer cow.osg