Added --subload command line option and test subload callback for testing purposes

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14812 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2015-03-31 19:29:02 +00:00
parent a7ba138dc7
commit 5229280901

View File

@ -39,6 +39,14 @@
typedef std::vector< osg::ref_ptr<osg::Image> > ImageList;
class SubloadCallback : public osg::Texture2DArray::SubloadCallback
{
public:
virtual void load(const osg::Texture2DArray& texture, osg::State& state) const { }
virtual void subload(const osg::Texture2DArray& texture, osg::State& state) const { }
};
osg::StateSet* createState(osg::ArgumentParser& arguments)
{
// read 4 2d images
@ -80,7 +88,12 @@ osg::StateSet* createState(osg::ArgumentParser& arguments)
texture->setFilter(osg::Texture2DArray::MIN_FILTER, osg::Texture2DArray::LINEAR_MIPMAP_LINEAR);
}
if (arguments.read("--packed"))
if (arguments.read("--subload"))
{
texture->setTextureSize(textureSize, textureSize, 1);
texture->setSubloadCallback(new SubloadCallback());
}
else if (arguments.read("--packed"))
{
OSG_NOTICE<<"Packing all images into a single osg::Image to pass to Texture2DArray."<<std::endl;
@ -107,7 +120,6 @@ osg::StateSet* createState(osg::ArgumentParser& arguments)
texture->setImage(3, image_3.get());
}
std::string vsFileName("shaders/osgtexture2DArray.vert");
std::string fsFileName("shaders/osgtexture2DArray.frag");