root/OpenSceneGraph/trunk/src/osgWrappers/serializers/osgText/Text.cpp @ 13041

Revision 13041, 3.4 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
Line 
1#include <osgText/Text>
2#include <osgDB/ObjectWrapper>
3#include <osgDB/InputStream>
4#include <osgDB/OutputStream>
5
6// _backdropHorizontalOffset, _backdropVerticalOffset
7static bool checkBackdropOffset( const osgText::Text& text )
8{
9    return true;
10}
11
12static bool readBackdropOffset( osgDB::InputStream& is, osgText::Text& text )
13{
14    float horizontal, vertical; is >> horizontal >> vertical;
15    text.setBackdropOffset( horizontal, vertical );
16    return true;
17}
18
19static bool writeBackdropOffset( osgDB::OutputStream& os, const osgText::Text& text )
20{
21    os << text.getBackdropHorizontalOffset()
22       << text.getBackdropVerticalOffset() << std::endl;
23    return true;
24}
25
26// _colorGradientTopLeft .. _colorGradientBottomRight
27static bool checkColorGradientCorners( const osgText::Text& text )
28{
29    return true;
30}
31
32static bool readColorGradientCorners( osgDB::InputStream& is, osgText::Text& text )
33{
34    osg::Vec4d lt, lb, rb, rt;
35    is >> osgDB::BEGIN_BRACKET;
36    is >> osgDB::PROPERTY("TopLeft") >> lt;
37    is >> osgDB::PROPERTY("BottomLeft") >> lb;
38    is >> osgDB::PROPERTY("BottomRight") >> rb;
39    is >> osgDB::PROPERTY("TopRight") >> rt;
40    is >> osgDB::END_BRACKET;
41    text.setColorGradientCorners( lt, lb, rb, rt );
42    return true;
43}
44
45static bool writeColorGradientCorners( osgDB::OutputStream& os, const osgText::Text& text )
46{
47    os << osgDB::BEGIN_BRACKET << std::endl;
48    os << osgDB::PROPERTY("TopLeft") << osg::Vec4d(text.getColorGradientTopLeft()) << std::endl;
49    os << osgDB::PROPERTY("BottomLeft") << osg::Vec4d(text.getColorGradientBottomLeft()) << std::endl;
50    os << osgDB::PROPERTY("BottomRight") << osg::Vec4d(text.getColorGradientBottomRight()) << std::endl;
51    os << osgDB::PROPERTY("TopRight") << osg::Vec4d(text.getColorGradientTopRight()) << std::endl;
52    os << osgDB::END_BRACKET << std::endl;
53    return true;
54}
55
56REGISTER_OBJECT_WRAPPER( osgText_Text,
57                         new osgText::Text,
58                         osgText::Text,
59                         "osg::Object osg::Drawable osgText::TextBase osgText::Text" )
60{
61    ADD_VEC4_SERIALIZER( Color, osg::Vec4() );  // _color
62
63    BEGIN_ENUM_SERIALIZER( BackdropType, NONE );
64        ADD_ENUM_VALUE( DROP_SHADOW_BOTTOM_RIGHT );
65        ADD_ENUM_VALUE( DROP_SHADOW_CENTER_RIGHT );
66        ADD_ENUM_VALUE( DROP_SHADOW_TOP_RIGHT );
67        ADD_ENUM_VALUE( DROP_SHADOW_BOTTOM_CENTER );
68        ADD_ENUM_VALUE( DROP_SHADOW_TOP_CENTER );
69        ADD_ENUM_VALUE( DROP_SHADOW_BOTTOM_LEFT );
70        ADD_ENUM_VALUE( DROP_SHADOW_CENTER_LEFT );
71        ADD_ENUM_VALUE( DROP_SHADOW_TOP_LEFT );
72        ADD_ENUM_VALUE( OUTLINE );
73        ADD_ENUM_VALUE( NONE );
74    END_ENUM_SERIALIZER();  // _backdropType
75
76    BEGIN_ENUM_SERIALIZER( BackdropImplementation, DEPTH_RANGE );
77        ADD_ENUM_VALUE( POLYGON_OFFSET );
78        ADD_ENUM_VALUE( NO_DEPTH_BUFFER );
79        ADD_ENUM_VALUE( DEPTH_RANGE );
80        ADD_ENUM_VALUE( STENCIL_BUFFER );
81    END_ENUM_SERIALIZER();  // _backdropImplementation
82
83    ADD_USER_SERIALIZER( BackdropOffset );  // _backdropHorizontalOffset, _backdropVerticalOffset
84    ADD_VEC4_SERIALIZER( BackdropColor, osg::Vec4() );  // _backdropColor
85
86    BEGIN_ENUM_SERIALIZER( ColorGradientMode, SOLID );
87        ADD_ENUM_VALUE( SOLID );
88        ADD_ENUM_VALUE( PER_CHARACTER );
89        ADD_ENUM_VALUE( OVERALL );
90    END_ENUM_SERIALIZER();  // _colorGradientMode
91
92    ADD_USER_SERIALIZER( ColorGradientCorners );  // _colorGradientTopLeft .. _colorGradientBottomRight
93}
Note: See TracBrowser for help on using the browser.