Added support for <image "start=10"> property that tells a video to start specificied number of sections into a video.
This commit is contained in:
@@ -252,7 +252,10 @@ public:
|
||||
imageSequence(false),
|
||||
imageSequencePagingMode(osg::ImageSequence::PAGE_AND_DISCARD_USED_IMAGES),
|
||||
imageSequenceInteractionMode(PLAY_AUTOMATICALLY_LIKE_MOVIE),
|
||||
blendingHint(USE_IMAGE_ALPHA)
|
||||
blendingHint(USE_IMAGE_ALPHA),
|
||||
delayTime(0.0),
|
||||
startTime(0.0),
|
||||
stopTime(-1.0)
|
||||
{}
|
||||
|
||||
std::string options;
|
||||
@@ -285,7 +288,11 @@ public:
|
||||
ON
|
||||
};
|
||||
|
||||
BlendingHint blendingHint;
|
||||
BlendingHint blendingHint;
|
||||
|
||||
double delayTime;
|
||||
double startTime;
|
||||
double stopTime;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -956,6 +956,24 @@ bool ReaderWriterP3DXML::getProperties(osgDB::XmlNode*cur, osgPresentation::Slid
|
||||
OSG_NOTIFY(_notifyLevel)<<"read blendingHint \""<<value.blendingHint<<"\""<<std::endl;
|
||||
}
|
||||
|
||||
if (getProperty(cur, "delay", value.delayTime))
|
||||
{
|
||||
propertiesRead = true;
|
||||
OSG_NOTIFY(_notifyLevel)<<"read delay \""<<value.delayTime<<"\""<<std::endl;
|
||||
}
|
||||
|
||||
if (getProperty(cur, "start", value.startTime))
|
||||
{
|
||||
propertiesRead = true;
|
||||
OSG_NOTIFY(_notifyLevel)<<"read start \""<<value.startTime<<"\""<<std::endl;
|
||||
}
|
||||
|
||||
if (getProperty(cur, "stop", value.stopTime))
|
||||
{
|
||||
propertiesRead = true;
|
||||
OSG_NOTIFY(_notifyLevel)<<"read stop \""<<value.stopTime<<"\""<<std::endl;
|
||||
}
|
||||
|
||||
/*
|
||||
if (getProperty(cur, "texcoord_offset", value.texcoord_offset))
|
||||
{
|
||||
|
||||
@@ -176,18 +176,19 @@ struct ImageStreamOperator : public ObjectOperator
|
||||
|
||||
virtual void enter(SlideEventHandler* seh)
|
||||
{
|
||||
OSG_INFO<<"enter() : _imageStream->rewind() + play"<<std::endl;
|
||||
OSG_NOTICE<<"enter() : _imageStream->rewind() + play"<<std::endl;
|
||||
|
||||
reset(seh);
|
||||
}
|
||||
|
||||
virtual void maintain(SlideEventHandler*)
|
||||
{
|
||||
OSG_NOTICE<<"ImageStreamOperator::maintain()"<<std::endl;
|
||||
}
|
||||
|
||||
virtual void leave(SlideEventHandler*)
|
||||
{
|
||||
OSG_INFO<<"leave() : _imageStream->pause()"<<std::endl;
|
||||
OSG_NOTICE<<"leave() : _imageStream->pause()"<<std::endl;
|
||||
|
||||
_imageStream->pause();
|
||||
}
|
||||
@@ -202,10 +203,19 @@ struct ImageStreamOperator : public ObjectOperator
|
||||
|
||||
virtual void reset(SlideEventHandler*)
|
||||
{
|
||||
OSG_NOTICE<<"ImageStreamOperator::reset()"<<std::endl;
|
||||
|
||||
osg::ImageStream::StreamStatus previousStatus = _imageStream->getStatus();
|
||||
|
||||
_imageStream->rewind();
|
||||
|
||||
double startTime;
|
||||
if (_imageStream->getUserValue("start",startTime))
|
||||
{
|
||||
_imageStream->seek(startTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
_imageStream->rewind();
|
||||
}
|
||||
|
||||
//_imageStream->setVolume(previousVolume);
|
||||
|
||||
|
||||
@@ -1114,6 +1114,10 @@ osg::Image* SlideShowConstructor::readImage(const std::string& filename, const I
|
||||
image = imageSequence;
|
||||
}
|
||||
|
||||
if (imageData.delayTime>0.0) image->setUserValue("delay",imageData.delayTime);
|
||||
if (imageData.startTime>0.0) image->setUserValue("start",imageData.startTime);
|
||||
if (imageData.stopTime>0.0) image->setUserValue("stop",imageData.stopTime);
|
||||
|
||||
return image.release();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user