Merge pull request #364 from mp3butcher/osganimbugfix

add osg::Program::BindUniformBlockList serialization
This commit is contained in:
OpenSceneGraph git repository 2017-10-16 10:16:49 +01:00 committed by GitHub
commit 7b9f44cb17

View File

@ -145,6 +145,39 @@ static bool writeComputeGroups( osgDB::OutputStream& os, const osg::Program& att
return true;
}
static bool checkBindUniformBlock( const osg::Program& node )
{
return true;
}
static bool readBindUniformBlock( osgDB::InputStream& is, osg::Program& p )
{
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
std::string name; unsigned int index;
for ( unsigned int i=0; i<size; ++i )
{
is >>name; is >>index;
p.addBindUniformBlock(name, index);
}
is >> is.END_BRACKET;
return true;
}
static bool writeBindUniformBlock( osgDB::OutputStream& os, const osg::Program& p )
{
unsigned int size = p.getUniformBlockBindingList().size();
os << size << os.BEGIN_BRACKET << std::endl;
for(osg::Program::UniformBlockBindingList::const_iterator bbit = p.getUniformBlockBindingList().begin();
bbit != p.getUniformBlockBindingList().end(); ++bbit)
{
os << bbit->first;
os << bbit->second;
}
os << os.END_BRACKET << std::endl;
return true;
}
REGISTER_OBJECT_WRAPPER( Program,
new osg::Program,
osg::Program,
@ -167,4 +200,8 @@ REGISTER_OBJECT_WRAPPER( Program,
ADD_USER_SERIALIZER( FeedBackVaryingsName );
ADD_USER_SERIALIZER( FeedBackMode );
}
{
UPDATE_TO_VERSION_SCOPED( 150 )
ADD_USER_SERIALIZER( BindUniformBlock );
}
}