Added control of auto option into slideshow3D
This commit is contained in:
parent
b925dcabaa
commit
46680be5eb
@ -53,7 +53,7 @@ void SlideEventHandler::set(osg::Node* model)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout<<"Not found presentation "<<std::endl;
|
std::cout<<"No presentation present in scene."<<std::endl;
|
||||||
|
|
||||||
_presentationSwitch = 0;
|
_presentationSwitch = 0;
|
||||||
_activeSlide = 0;
|
_activeSlide = 0;
|
||||||
@ -70,7 +70,7 @@ void SlideEventHandler::set(osg::Node* model)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout<<"Not found slide either "<<std::endl;
|
std::cout<<"No slides present in scene, unable to operate as a slideshow."<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,12 @@ public:
|
|||||||
bool nextLayer();
|
bool nextLayer();
|
||||||
bool previousLayer();
|
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:
|
protected:
|
||||||
|
|
||||||
~SlideEventHandler() {}
|
~SlideEventHandler() {}
|
||||||
|
@ -39,9 +39,19 @@ int main( int argc, char **argv )
|
|||||||
// get details on keyboard and mouse bindings used by the viewer.
|
// get details on keyboard and mouse bindings used by the viewer.
|
||||||
viewer.getUsage(*arguments.getApplicationUsage());
|
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.
|
// register the slide event handler - which moves the presentation from slide to slide, layer to layer.
|
||||||
SlideEventHandler* seh = new SlideEventHandler;
|
SlideEventHandler* seh = new SlideEventHandler;
|
||||||
viewer.getEventHandlerList().push_front(seh);
|
viewer.getEventHandlerList().push_front(seh);
|
||||||
|
|
||||||
|
seh->setAutoSteppingActive(autoSteppingActive);
|
||||||
|
seh->setTimeDelayBetweenSlides(timeDelayBetweenSlides);
|
||||||
|
|
||||||
// if user request help write it out to cout.
|
// if user request help write it out to cout.
|
||||||
if (arguments.read("-h") || arguments.read("--help"))
|
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.
|
// read the scene from the list of file specified commandline args.
|
||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
||||||
|
|
||||||
// if no model loaded create a default presentation.
|
// // if no model loaded create a default presentation.
|
||||||
if (!loadedModel)
|
// if (!loadedModel)
|
||||||
{
|
// {
|
||||||
loadedModel = createDefaultPresentation();
|
// loadedModel = createDefaultPresentation();
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
// if no model has been successfully loaded report failure.
|
// if no model has been successfully loaded report failure.
|
||||||
|
@ -4,10 +4,10 @@ osgversion
|
|||||||
echo osglogo
|
echo osglogo
|
||||||
osglogo
|
osglogo
|
||||||
|
|
||||||
echo slideshow3D introduction.xml
|
echo slideshow3D -a introduction.xml
|
||||||
slideshow3D introduction.xml
|
slideshow3D introduction.xml
|
||||||
|
|
||||||
echo slideshow3D models.xml
|
echo slideshow3D -a models.xml
|
||||||
slideshow3D models.xml
|
slideshow3D models.xml
|
||||||
|
|
||||||
echo osgviewer cow.osg
|
echo osgviewer cow.osg
|
||||||
|
Loading…
Reference in New Issue
Block a user