Added --page-and-discard, --page-and-retain, --preload and --length command line options
This commit is contained in:
parent
71af4851c7
commit
65cb2e625f
@ -46,9 +46,34 @@ osg::StateSet* createState(osg::ArgumentParser& arguments)
|
|||||||
{
|
{
|
||||||
osg::ref_ptr<osg::ImageSequence> imageSequence = new osg::ImageSequence;
|
osg::ref_ptr<osg::ImageSequence> imageSequence = new osg::ImageSequence;
|
||||||
|
|
||||||
|
bool preLoad = true;
|
||||||
|
|
||||||
|
while (arguments.read("--page-and-discard"))
|
||||||
|
{
|
||||||
|
imageSequence->setMode(osg::ImageSequence::PAGE_AND_DISCARD_USED_IMAGES);
|
||||||
|
preLoad = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (arguments.read("--page-and-retain"))
|
||||||
|
{
|
||||||
|
imageSequence->setMode(osg::ImageSequence::PAGE_AND_RETAIN_IMAGES);
|
||||||
|
preLoad = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (arguments.read("--preload"))
|
||||||
|
{
|
||||||
|
imageSequence->setMode(osg::ImageSequence::PRE_LOAD_ALL_IMAGES);
|
||||||
|
preLoad = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
double length = -1.0;
|
||||||
|
while (arguments.read("--length",length)) {}
|
||||||
|
|
||||||
if (arguments.argc()>1)
|
if (arguments.argc()>1)
|
||||||
{
|
{
|
||||||
for(unsigned int i=1; i<arguments.argc(); ++i)
|
for(unsigned int i=1; i<arguments.argc(); ++i)
|
||||||
|
{
|
||||||
|
if (preLoad)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Image> image = osgDB::readImageFile(arguments[i]);
|
osg::ref_ptr<osg::Image> image = osgDB::readImageFile(arguments[i]);
|
||||||
if (image.valid())
|
if (image.valid())
|
||||||
@ -56,11 +81,31 @@ osg::StateSet* createState(osg::ArgumentParser& arguments)
|
|||||||
imageSequence->addImage(image.get());
|
imageSequence->addImage(image.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
imageSequence->addImageFile(arguments[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (length>0.0)
|
||||||
|
{
|
||||||
|
imageSequence->setLength(length);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
imageSequence->setLength(float(imageSequence->getImages().size())*0.1f);
|
imageSequence->setLength(float(imageSequence->getImages().size())*0.1f);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (length>0.0)
|
||||||
|
{
|
||||||
|
imageSequence->setLength(length);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
imageSequence->setLength(4.0);
|
imageSequence->setLength(4.0);
|
||||||
|
}
|
||||||
imageSequence->addImage(osgDB::readImageFile("Cubemap_axis/posx.png"));
|
imageSequence->addImage(osgDB::readImageFile("Cubemap_axis/posx.png"));
|
||||||
imageSequence->addImage(osgDB::readImageFile("Cubemap_axis/negx.png"));
|
imageSequence->addImage(osgDB::readImageFile("Cubemap_axis/negx.png"));
|
||||||
imageSequence->addImage(osgDB::readImageFile("Cubemap_axis/posy.png"));
|
imageSequence->addImage(osgDB::readImageFile("Cubemap_axis/posy.png"));
|
||||||
|
Loading…
Reference in New Issue
Block a user