2
#include <osgDB/ObjectWrapper>
3
#include <osgDB/Serializer>
5
static bool checkData( const osg::ShaderBinary& sb )
10
static bool readData( osgDB::InputStream& is, osg::ShaderBinary& sb )
12
unsigned int size; is >> size;
13
char* data = new char[size];
16
is.readCharArray( data, size );
20
is >> osgDB::BEGIN_BRACKET;
21
for ( unsigned int i=0; i<size; ++i )
23
is >> std::hex >> data[i] >> std::dec;
25
is >> osgDB::END_BRACKET;
27
sb.assign( size, (unsigned char*)data );
32
static bool writeData( osgDB::OutputStream& os, const osg::ShaderBinary& sb )
36
os << (unsigned int)sb.getSize();
37
os.writeCharArray( (char*)sb.getData(), sb.getSize() );
41
const unsigned char* data = sb.getData();
42
os << osgDB::BEGIN_BRACKET << std::endl;
43
for ( unsigned int i=0; i<sb.getSize(); ++i )
45
os << std::hex << data[i] << std::dec << std::endl;
47
os << osgDB::END_BRACKET << std::endl;
52
REGISTER_OBJECT_WRAPPER( ShaderBinary,
53
new osg::ShaderBinary,
55
"osg::Object osg::ShaderBinary" )
57
ADD_USER_SERIALIZER( Data ); // _data