Update Text wrappers to handle new Color member

This commit is contained in:
Robert Osfield
2010-11-19 09:57:56 +00:00
parent ade360819e
commit 426d2a50d8
3 changed files with 22 additions and 17 deletions

View File

@@ -103,18 +103,6 @@ bool Text_readLocalData(osg::Object &obj, osgDB::Input &fr)
bool itAdvanced = false;
// color
if (fr[0].matchWord("color"))
{
osg::Vec4 c;
if (fr[1].getFloat(c.x()) && fr[2].getFloat(c.y()) && fr[3].getFloat(c.z()) && fr[4].getFloat(c.w()))
{
text.setColor(c);
fr += 4;
itAdvanced = true;
}
}
// backdropType
if (fr[0].matchWord("backdropType"))
{
@@ -253,10 +241,6 @@ bool Text_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
const osgText::Text &text = static_cast<const osgText::Text &>(obj);
// color
osg::Vec4 c = text.getColor();
fw.indent() << "color " << c.x() << " " << c.y() << " " << c.z() << " " << c.w() << std::endl;
// backdropType
fw.indent() << "backdropType " << convertBackdropTypeEnumToString(text.getBackdropType()) << std::endl;
@@ -267,7 +251,7 @@ bool Text_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
fw.indent() << "backdropVerticalOffset " << text.getBackdropVerticalOffset() << std::endl;
// backdropColor
c = text.getBackdropColor();
osg::Vec4 c = text.getBackdropColor();
fw.indent() << "backdropColor " << c.x() << " " << c.y() << " " << c.z() << " " << c.w() << std::endl;
// backdropImplementation

View File

@@ -30,6 +30,18 @@ bool TextBase_readLocalData(osg::Object &obj, osgDB::Input &fr)
osgText::Text &text = static_cast<osgText::Text &>(obj);
bool itAdvanced = false;
// color
if (fr[0].matchWord("color"))
{
osg::Vec4 c;
if (fr[1].getFloat(c.x()) && fr[2].getFloat(c.y()) && fr[3].getFloat(c.z()) && fr[4].getFloat(c.w()))
{
text.setColor(c);
fr += 4;
itAdvanced = true;
}
}
if (fr.matchSequence("font %w"))
{
text.setFont(fr[1].getStr());
@@ -288,6 +300,10 @@ bool TextBase_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
const osgText::Text &text = static_cast<const osgText::Text &>(obj);
// color
osg::Vec4 c = text.getColor();
fw.indent() << "color " << c.x() << " " << c.y() << " " << c.z() << " " << c.w() << std::endl;
if (text.getFont())
{
fw.indent() << "font " << text.getFont()->getFileName() << std::endl;

View File

@@ -14,4 +14,9 @@ REGISTER_OBJECT_WRAPPER( osgText_Text3D,
ADD_ENUM_VALUE( PER_FACE );
ADD_ENUM_VALUE( PER_GLYPH );
END_ENUM_SERIALIZER(); // _renderMode
UPDATE_TO_VERSION( 68 )
{
ADD_VEC4_SERIALIZER( Color, osg::Vec4(1.0,1.0,1.0,1.0) ); // _color
}
}