Deprecated Text:BackdropImplementation, removing the backend as it no longer required when using shaders for backdrop effects
This commit is contained in:
@@ -90,7 +90,7 @@ void Text::write(DataOutputStream* out){
|
||||
out->writeFloat(getBackdropVerticalOffset());
|
||||
|
||||
out->writeVec4(getBackdropColor());
|
||||
out->writeUInt(getBackdropImplementation());
|
||||
out->writeUInt(4); // old DELAYED_DEPTH_WRITES
|
||||
|
||||
out->writeUInt(getColorGradientMode());
|
||||
out->writeVec4(getColorGradientTopLeft());
|
||||
@@ -213,7 +213,7 @@ void Text::read(DataInputStream* in){
|
||||
setBackdropOffset(horizontalOffset,verticalOffset);
|
||||
|
||||
setBackdropColor(in->readVec4());
|
||||
setBackdropImplementation((osgText::Text::BackdropImplementation) in->readUInt());
|
||||
in->readUInt(); // read old BackdropImplementation value, no longer used
|
||||
setColorGradientMode((osgText::Text::ColorGradientMode) in->readUInt());
|
||||
|
||||
osg::Vec4 colorGradientTopLeft,colorGradientBottomLeft,colorGradientBottomRight,colorGradientTopRight;
|
||||
|
||||
@@ -31,11 +31,6 @@ using namespace osgText;
|
||||
Text::Text():
|
||||
_enableDepthWrites(true),
|
||||
_backdropType(NONE),
|
||||
#if 1
|
||||
_backdropImplementation(DELAYED_DEPTH_WRITES),
|
||||
#else
|
||||
_backdropImplementation(USE_SHADERS),
|
||||
#endif
|
||||
_backdropHorizontalOffset(0.07f),
|
||||
_backdropVerticalOffset(0.07f),
|
||||
_backdropColor(0.0f, 0.0f, 0.0f, 1.0f),
|
||||
@@ -47,17 +42,6 @@ Text::Text():
|
||||
{
|
||||
_supportsVertexBufferObjects = true;
|
||||
|
||||
char *ptr;
|
||||
if ((ptr = getenv("OSG_SDF_TEXT")) != 0)
|
||||
{
|
||||
_backdropImplementation = USE_SHADERS;
|
||||
}
|
||||
else if ((ptr = getenv("OSG_GREYSCALE_TEXT")) != 0)
|
||||
{
|
||||
_backdropImplementation = DELAYED_DEPTH_WRITES;
|
||||
}
|
||||
|
||||
|
||||
assignStateSet();
|
||||
}
|
||||
|
||||
@@ -65,7 +49,6 @@ Text::Text(const Text& text,const osg::CopyOp& copyop):
|
||||
osgText::TextBase(text,copyop),
|
||||
_enableDepthWrites(text._enableDepthWrites),
|
||||
_backdropType(text._backdropType),
|
||||
_backdropImplementation(text._backdropImplementation),
|
||||
_backdropHorizontalOffset(text._backdropHorizontalOffset),
|
||||
_backdropVerticalOffset(text._backdropVerticalOffset),
|
||||
_backdropColor(text._backdropColor),
|
||||
@@ -93,7 +76,7 @@ osg::StateSet* Text::createStateSet()
|
||||
|
||||
std::stringstream ss;
|
||||
osg::StateSet::DefineList defineList;
|
||||
if (_backdropType!=NONE && _backdropImplementation==USE_SHADERS)
|
||||
if (_backdropType!=NONE)
|
||||
{
|
||||
ss.str("");
|
||||
ss << "vec4("<<_backdropColor.r()<<", "<<_backdropColor.g()<<", "<<_backdropColor.b()<<", "<<_backdropColor.a()<<")";
|
||||
@@ -128,8 +111,6 @@ osg::StateSet* Text::createStateSet()
|
||||
|
||||
defineList["SHADOW"] = osg::StateSet::DefinePair(ss.str(), osg::StateAttribute::ON);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (activeFont->getGlyphTextureFeatures()!=GlyphTexture::GREYSCALE)
|
||||
@@ -147,7 +128,6 @@ osg::StateSet* Text::createStateSet()
|
||||
}
|
||||
|
||||
#if 0
|
||||
OSG_NOTICE<<"Text::createStateSet() _backdropType="<<_backdropType<<", _backdropImplementation="<<_backdropImplementation<<std::endl;
|
||||
OSG_NOTICE<<"Text::createStateSet() defines:"<<defineList.size()<<std::endl;
|
||||
for(osg::StateSet::DefineList::iterator itr = defineList.begin();
|
||||
itr != defineList.end();
|
||||
@@ -1294,18 +1274,6 @@ void Text::setBackdropType(BackdropType type)
|
||||
computeGlyphRepresentation();
|
||||
}
|
||||
|
||||
void Text::setBackdropImplementation(BackdropImplementation implementation)
|
||||
{
|
||||
if (_backdropImplementation==implementation) return;
|
||||
|
||||
_backdropImplementation = implementation;
|
||||
|
||||
assignStateSet();
|
||||
|
||||
computeGlyphRepresentation();
|
||||
}
|
||||
|
||||
|
||||
void Text::setBackdropOffset(float offset)
|
||||
{
|
||||
_backdropHorizontalOffset = offset;
|
||||
|
||||
@@ -134,7 +134,6 @@ void Label::setFontColor(const Color& c) {
|
||||
|
||||
void Label::setShadow(point_type offset) {
|
||||
_text->setBackdropType(osgText::Text::DROP_SHADOW_BOTTOM_RIGHT);
|
||||
_text->setBackdropImplementation(osgText::Text::NO_DEPTH_BUFFER);
|
||||
_text->setBackdropOffset(offset);
|
||||
|
||||
_calculateSize(getTextSize());
|
||||
|
||||
@@ -57,27 +57,6 @@ std::string convertBackdropTypeEnumToString(osgText::Text::BackdropType backdrop
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
osgText::Text::BackdropImplementation convertBackdropImplementationStringToEnum(std::string & str)
|
||||
{
|
||||
if (str=="POLYGON_OFFSET") return osgText::Text::POLYGON_OFFSET;
|
||||
else if (str=="NO_DEPTH_BUFFER") return osgText::Text::NO_DEPTH_BUFFER;
|
||||
else if (str=="DEPTH_RANGE") return osgText::Text::DEPTH_RANGE;
|
||||
else if (str=="STENCIL_BUFFER") return osgText::Text::STENCIL_BUFFER;
|
||||
else return static_cast<osgText::Text::BackdropImplementation>(-1);
|
||||
}
|
||||
std::string convertBackdropImplementationEnumToString(osgText::Text::BackdropImplementation backdropImplementation)
|
||||
{
|
||||
switch (backdropImplementation)
|
||||
{
|
||||
case osgText::Text::POLYGON_OFFSET: return "POLYGON_OFFSET";
|
||||
case osgText::Text::NO_DEPTH_BUFFER: return "NO_DEPTH_BUFFER";
|
||||
case osgText::Text::DEPTH_RANGE: return "DEPTH_RANGE";
|
||||
case osgText::Text::STENCIL_BUFFER: return "STENCIL_BUFFER";
|
||||
default : return "";
|
||||
}
|
||||
}
|
||||
|
||||
osgText::Text::ColorGradientMode convertColorGradientModeStringToEnum(std::string & str)
|
||||
{
|
||||
if (str=="SOLID") return osgText::Text::SOLID;
|
||||
@@ -155,12 +134,6 @@ bool Text_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
// backdropImplementation
|
||||
if (fr[0].matchWord("backdropImplementation"))
|
||||
{
|
||||
std::string str = fr[1].getStr();
|
||||
osgText::Text::BackdropImplementation backdropImplementation = convertBackdropImplementationStringToEnum(str);
|
||||
|
||||
if (backdropImplementation != static_cast<osgText::Text::BackdropImplementation>(-1))
|
||||
text.setBackdropImplementation(backdropImplementation);
|
||||
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
@@ -254,9 +227,6 @@ bool Text_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
osg::Vec4 c = text.getBackdropColor();
|
||||
fw.indent() << "backdropColor " << c.x() << " " << c.y() << " " << c.z() << " " << c.w() << std::endl;
|
||||
|
||||
// backdropImplementation
|
||||
fw.indent() << "backdropImplementation " << convertBackdropImplementationEnumToString(text.getBackdropImplementation()) << std::endl;
|
||||
|
||||
// colorGradientMode
|
||||
fw.indent() << "colorGradientMode " << convertColorGradientModeEnumToString(text.getColorGradientMode()) << std::endl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user