From 1f4e712fd8af57d18a8386a20a98acda06dd52d2 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 6 Oct 2008 17:03:32 +0000 Subject: [PATCH] Improved the ImageSequence::setLength() settting. --- examples/osgimagesequence/osgimagesequence.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/osgimagesequence/osgimagesequence.cpp b/examples/osgimagesequence/osgimagesequence.cpp index 585f29f50..a5bd55d4e 100644 --- a/examples/osgimagesequence/osgimagesequence.cpp +++ b/examples/osgimagesequence/osgimagesequence.cpp @@ -93,7 +93,10 @@ osg::StateSet* createState(osg::ArgumentParser& arguments) } else { - imageSequence->setLength(float(imageSequence->getImages().size())*0.1f); + unsigned int maxNum = osg::maximum(imageSequence->getFileNames().size(), + imageSequence->getImages().size()); + + imageSequence->setLength(float(maxNum)*0.1f); } } else @@ -125,18 +128,13 @@ osg::StateSet* createState(osg::ArgumentParser& arguments) texture->setResizeNonPowerOfTwoHint(false); texture->setImage(imageSequence.get()); //texture->setTextureSize(512,512); - - //texture->setUpdateCallback(new osg::ImageSequence::UpdateCallback); #else osg::TextureRectangle* texture = new osg::TextureRectangle; texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR); texture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR); texture->setWrap(osg::Texture::WRAP_R,osg::Texture::REPEAT); - // texture->setResizeNonPowerOfTwoHint(false); texture->setImage(imageSequence.get()); //texture->setTextureSize(512,512); - - //texture->setUpdateCallback(new osg::ImageSequence::UpdateCallback); #endif // create the StateSet to store the texture data