~ubuntu-branches/debian/experimental/openscenegraph/experimental

« back to all changes in this revision

Viewing changes to OpenSceneGraph/src/osgWrappers/serializers/osg/PolygonStipple.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alberto Luaces
  • Date: 2011-01-29 11:36:29 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20110129113629-qisrm2kdqlurc7t3
Tags: 2.9.11-1
* Removed bug-555869-ftbfs_with_binutils_gold.dpatch since upstream has
  already taken care of the issue.
* Removed bug-528229.dpatch since the pkgconfig files are now also split
  in upstream.
* Removed explicit dependency on GLU.
* Upstream no longer includes osgIntrospection (Closes: #592420).
* Disabled zip plugin as its implementation stores an embedded copy of
  zlib.
* Enabled Qt support. Thanks James Goppert.
* Enabled SVG and PDF plugins. Thanks James Goppert.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <osg/PolygonStipple>
 
2
#include <osgDB/ObjectWrapper>
 
3
#include <osgDB/InputStream>
 
4
#include <osgDB/OutputStream>
 
5
 
 
6
static bool checkMask( const osg::PolygonStipple& attr )
 
7
{
 
8
    return true;
 
9
}
 
10
 
 
11
static bool readMask( osgDB::InputStream& is, osg::PolygonStipple& attr )
 
12
{
 
13
    char mask[128] = {0};
 
14
    if ( is.isBinary() )
 
15
    {
 
16
        unsigned int size; is >> size;
 
17
        is.readCharArray( mask, size );
 
18
    }
 
19
    else
 
20
    {
 
21
        is >> osgDB::BEGIN_BRACKET;
 
22
        for ( unsigned int i=0; i<128; ++i )
 
23
        {
 
24
            is >> std::hex >> mask[i] >> std::dec;
 
25
        }
 
26
        is >> osgDB::END_BRACKET;
 
27
    }
 
28
    attr.setMask( (GLubyte*)mask );
 
29
    return true;
 
30
}
 
31
 
 
32
static bool writeMask( osgDB::OutputStream& os, const osg::PolygonStipple& attr )
 
33
{
 
34
    if ( os.isBinary() )
 
35
    {
 
36
        os << (unsigned int)128;
 
37
        os.writeCharArray( (char*)attr.getMask(), 128 );
 
38
    }
 
39
    else
 
40
    {
 
41
        const GLubyte* mask = attr.getMask();
 
42
        os << osgDB::BEGIN_BRACKET << std::endl;
 
43
        for ( unsigned int i=0; i<128; ++i )
 
44
        {
 
45
            os << std::hex << mask[i] << std::dec << std::endl;
 
46
        }
 
47
        os << osgDB::END_BRACKET << std::endl;
 
48
    }
 
49
    return true;
 
50
}
 
51
 
 
52
REGISTER_OBJECT_WRAPPER( PolygonStipple,
 
53
                         new osg::PolygonStipple,
 
54
                         osg::PolygonStipple,
 
55
                         "osg::Object osg::StateAttribute osg::PolygonStipple" )
 
56
{
 
57
    ADD_USER_SERIALIZER( Mask );  // _mask
 
58
}