1
#include <osg/PolygonStipple>
2
#include <osgDB/ObjectWrapper>
3
#include <osgDB/InputStream>
4
#include <osgDB/OutputStream>
6
static bool checkMask( const osg::PolygonStipple& attr )
11
static bool readMask( osgDB::InputStream& is, osg::PolygonStipple& attr )
16
unsigned int size; is >> size;
17
is.readCharArray( mask, size );
21
is >> osgDB::BEGIN_BRACKET;
22
for ( unsigned int i=0; i<128; ++i )
24
is >> std::hex >> mask[i] >> std::dec;
26
is >> osgDB::END_BRACKET;
28
attr.setMask( (GLubyte*)mask );
32
static bool writeMask( osgDB::OutputStream& os, const osg::PolygonStipple& attr )
36
os << (unsigned int)128;
37
os.writeCharArray( (char*)attr.getMask(), 128 );
41
const GLubyte* mask = attr.getMask();
42
os << osgDB::BEGIN_BRACKET << std::endl;
43
for ( unsigned int i=0; i<128; ++i )
45
os << std::hex << mask[i] << std::dec << std::endl;
47
os << osgDB::END_BRACKET << std::endl;
52
REGISTER_OBJECT_WRAPPER( PolygonStipple,
53
new osg::PolygonStipple,
55
"osg::Object osg::StateAttribute osg::PolygonStipple" )
57
ADD_USER_SERIALIZER( Mask ); // _mask